Back to product page

ListNames method


Lists file and folder names in a directory on the server.

Type

None

Syntax

  • Basic
object.ListNames [RemotePath]
The ListNames(object,RemotePath) syntax has these parts:
objectAn expression evaluating to an object of type wodSFTP.
RemotePathOptional. A Variant value. Full path to a directory on the server.

Remarks

The ListNames method will send a request to the server to retrieve just the names of files and directories in the specified path. Once the server sends back data, the ListItems event will be fired (possibly more than once!!) containing a list of files sent by the server, each one in a separate line, split by a CRLF sequence. If the item is a directory, wodSFTP will append / (slash) to the end of it. The ListItems event is fired more than once if the total number of files is too large to be handled by one SFTP packet. You should wait for the Done event to declare the listing as finished.

Once completed, the Done event will be fired. If no error occurs, the ErrorCode argument in the Done event will be set to 0 (zero). If an error occurs, the ErrorCode will hold the number of the error and ErrorText will contain a description for the error.

No wildcards can be used for RemotePath argument. The RFC protocol specification for SFTP does not allow them.

To retrieve a full listing of files/directories for a given path (including size, permissions, dates...) you should use the ListDir method. To retrieve the structure of the directory inside an already parsed collection of SftpItem objects, you should use the ListAttributes method.

Platforms

Windows