Search code examples
vb6ftpinet

How to return all directories from within FTP site into VB6 Listbox using Inet.OCX?


I have a VB6 project, it connects fine to ftp remote server (i.e : ftp://ftp.microsoft.com), i want to list all the directories names in the ftp server into a ListBox using Inet1.ocx only . how can i do that ?


Solution

  • Taken from @AhmedEbied's comment to my answer below.


    Ok, i got it. We'll use (DIR), the FTP command to retrieve the directories within the FTP server. Using (DIR) COMMAND Inet1.Execute , ("DIR")

    ' CommandButton 
    Private Sub Get_Dir_Click() 
      Dim Data as String, Data1 as String 
    
      ' Get List of all files 
      Do Data1 = Inet1.GetChunk(1024, icString) 
        Data = Data & Data1 
      Loop While Len(Data1) <> 0 
    
      Text4.Text = Data 
    End Sub 
    

    Of course I had the UsrName, PassWord and URL in place.