wwSFTP::FtpListFiles

Gets a file listing for a remote folder and returns a collection of objects with the following properties:

  • Name
  • Length
  • FileAttribute (16 - file, 128 - directory)
  • LastWriteTime

You can use this method instead of aFtpDir() of the base class, which is not supported by this SFPT implementation.

o.FtpListFiles(lcPath)

Return Value

Collection of file objects or null

Parameters

lcPath
The path on the server to return files for. Pass an empty string for the current active folder. Note it doesn't work with wildcards or filespecs only folder names.

Example

loFtp = CREATEOBJECT("wwFtp")
loFtp.cFtpServer = "west-wind.com"
loFtp.nFtpPort = 23
loFtp.cUsername = "tester"
loFtp.cPassword = "password"

loFtp.FtpConnect()

*** List files in active folder
loFiles = loFtp.FtpListFiles("")  && or: "/subfolder" or "subfolder2" (relative)
loFtp.FtpClose()

this.AssertTrue(!ISNULL(loFiles),loFtp.cErrorMsg)

FOR EACH loFile IN loFiles FOXOBJECT
  ? loFile.Name + " - " +;
    TRANSFORM(loFile.Length) + " - " +;
    TRANSFORM(loFile.FileAttribute) + " -  " +;
    TRANSFORM(loFile.LastWriteTime)
ENDFOR

See also:

Class wwSFTP

© West Wind Technologies, 1996-2019 • Updated: 08/09/17
Comment or report problem with topic