Results 1 to 3 of 3

Thread: Parse FTP List Reply

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Parse FTP List Reply

    Hi i connected to my FTP server and have recived a directory listing like below...

    << 125 File status okay; about to open data connection.

    drwx------ 1 Owner Group 512 Mar 25 20:15 badgerb
    -rwx------ 1 Owner Group 3943 Mar 01 22:57 bc.asp
    drwx------ 1 Owner Group 512 Apr 10 07:57 BCDB
    -rwx------ 1 Owner Group 1710 Mar 01 22:57 bcprocess.asp
    drwx------ 1 Owner Group 512 Jan 19 15:10 cgi-bin
    -rwx------ 1 Owner Group 1051 Mar 06 10:02 compact.asp
    -rwx------ 1 Owner Group 205 Jan 20 09:01 connstr.asp
    -rwx------ 1 Owner Group 10846 Jan 20 08:59 contact.asp


    << 226 Closing data connection.

    how can i parse each file into a UDT ?

    and all the Directorys into an array for placing into a treeview ?

    thanks people

    Sam Lad

  2. #2
    Fanatic Member TheVader's Avatar
    Join Date
    Oct 2002
    Location
    Rotterdam, the Netherlands
    Posts
    871
    You can seperate the information with string manipulation. In this code I exclude the names and type (directory/file). Hope it's useful.
    VB Code:
    1. Dim strList(3) As String
    2. Dim i As Integer
    3.  
    4. strList(0) = "drwx------ 1 Owner Group 512 Mar 25 20:15 badgerb"
    5. strList(1) = "-rwx------ 1 Owner Group 3943 Mar 01 22:57 bc.asp"
    6. strList(2) = "drwx------ 1 Owner Group 512 Apr 10 07:57 BCDB"
    7.  
    8. For i = 0 To UBound(strList) - 1
    9.     If Left$(strList(i), 1) = "d" Then
    10.         'directory
    11.         MsgBox "Directory: " & Right(strList(i), Len(strList(i)) - InStrRev(strList(i), " "))
    12.     Else
    13.         'file
    14.         MsgBox "File: " & Right(strList(i), Len(strList(i)) - InStrRev(strList(i), " "))
    15.     End If
    16. Next i
    Author for Visual Basic Web Magazine

    My articles on the Web Browser Control:
    Using the Web Browser Control & Using the DHTML Document Object Model

    The examples referenced in the articles can be found here:

  3. #3

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    true yeah i got a udt populated but i think with tweaking i will have it right once i have i will post for future reference

    thanks man

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width