Login  
Search All Forums
Dart Home | PowerTCP FTP for ActiveX | Custom Development Reply | PowerTCP FTP for ActiveX Topics | Forums   
AuthorForum: PowerTCP FTP for ActiveX
Topic: Help with listing property
User1266

Posts: 1
Member Since: 07/16/00
posted July 16, 2000 4:27 PM

I am haveing a problem with the listing property, consider the following code:

  Dim x As DartFtp.Ftp
  Dim i As Long
  
  Set x = New DartFtp.Ftp
  
  With x
  
    ' passive *must* be false to avoid PASV errors
    .Passive = False
    
    ' this is a xylan switch on our network
    .Login "172.16.5.10", "admin", "switch"
    
    .Directory = "/simm"
    
    ' List does not work, so I used this method
    .NameList
    
    ' this shows the files in the folder as expected
    Debug.Print .Listing.Text
    
    ' now that we have a list, print out each entry
    For i = 1 To .Listing.Count
      ' nothing prints here!!
      Debug.Print .Listing(i).Name
    Next
    
    ' drop the connection
    .Logout
    
  End With

The x.Listing.Text property works as expected, but the loop printing each file name just prints an empty string. I ftp-ing into a xylan omnistack switch (if this information is useful).

Please let me know if this is a known defect or a work-around exists
N/A posted April 28, 2001 5:05 PM

When using the Namelist, you only get a string array containing files and/or folder in your list directory. The Listing object only stores the string, it does not give you the info on each dir/file. But this will help you:
put a ListBox control on your form in vb, name it TempList. Then use this function to get your desired listing in the ListBox:

private function ParseDir(sRemoteDir as string)
Dim le As ListEntry
Dim i As Integer
Dim j As Integer
i = 1
j = 1
Ftp1.Type = ftpAscii
Ftp1.NameList sRemoteDir
TempList.Clear'keep all files and dirs here - exactly as sent by server
Do'add files and dirs in a list box
 i = InStr(j, Ftp1.Listing.Text, vbCrLf, vbTextCompare)
 If i = 0 Then Exit Do
  TempList.AddItem Mid(Ftp1.Listing.Text, j, i - j)
  j = i + 2
Loop
end function

After calling this function, use the listbox to populate whatever you like, as it now contains the files/dirs desired by you!
Cheers, Buggy.
Reply | PowerTCP FTP for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX