Welcome to the Xceed Community | Help
Community Search  
More Search Options

I am trying to get a listing of a remote directory on an FTP server, however no information is being returned. Why?

Sort Posts: Previous Next
  •  10-10-2008, 11:15 AM Post no. 28322

    I am trying to get a listing of a remote directory on an FTP server, however no information is being returned. Why?

    This error is occuring because parsing for the FTP server you are using is most likely not yet implemented.

    This said, you have 2 options:

    1- You can manually parse the lines you receive by doing the following:

    Set the ListParsingFlags property to flpManualParsing. This will trigger the ParsingListLine event where you can parse the lines received manually. For example (this code is to be placed in the ParsingListLine event and is for an AS/400 FTP server):

    Static lLastSize As Long

    Dim lPos As Integer
    lPos = InStr(sLineToParse, "*FILE")

    If lPos = 0 Then
       lPos = InStr(sLineToParse, "*MEM")

       If lPos = 0 Then
          Debug.Print "Invalid line!"
       Else

       ' This is the second line
       lPos = lPos + 4
       Do While Mid(sLineToParse, lPos, 1) = " "
           lPos = lPos + 1
       Loop

        sName = Right(sLineToParse, Len(sLineToParse) - lPos + 1)
        lFileSize = lLastSize
        bParsed = True
      End If
    Else
      ' This is the first line. We just keep the size.
      ' We could also keep the date and time in another static variable.
      lLastSize = Val(Mid(sLineToParse, 6, 16))
    End If


    2- The second option (if you find the first to be a little tedious) is to set the ListParsingFlags property to flpFilenameOnly and flpAutomaticParsing

    XceedFtp1.ListParsingFlags = flpFilenameOnly +flpAutomaticParsing

    This is the equivalent of the NLST command. It will allow you to retrieve the file name through the GetFolderContents (or ListFolderContents) method however the rest of the file information (like the date and size) will not be accessible.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.