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

StackOverflow https://stackoverflow.com/questions/10270674

  •  02-06-2021
  •  | 
  •  

Question

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 ?

Was it helpful?

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.

OTHER TIPS

You could install an FTP-capable ActiveX component, like this one: Chilkat FTP. Note that there is a free one, called FTP, and a paid version, called FTP2. For your purposes, the free one should be enough.

See the documentation and the examples page to get started.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top