Method SFTPClient():directory() Foundation

Lists files and directories.

Syntax
:directory( [<cFilePath>], [<lListDirectories>] ) --> aResult
Parameters
<cFilePath>
A fully qualified or relative path which specifies the files or directories to be listed. Wildcards can be used in the filename portion of the path. The wildcard "*" matches any number of arbitrary characters, while the wildcard "?" matches exactly one arbitrary character. If no path is specified in <cPath>, the default value "*" is used, which lists all files in the current directory.
<lListDirectories>
A optional logical value. With the value .T. (true), directories are also listed in addition to files. The parameter defaults to .F. (false) in which case only files are listed.
Return

An array of DataObjects, one for each file or directory element on the remote server. An empty array is returned in case of an error or when the remote directory is empty.

The DataObjects in the array have the following members:

- :Name: A character string specifying the name of the remote file or directory.

- :Size: A numeric value specifying the size of the element.

- :UpdateDate: The date of the last update.

- :UpdateTime: A character string with the time of the last update. The specified time has the following format: "HH:MM:SS". When an update time is not available, the value in the member is "00:00:00".

- :IsDir: The logcal value .T. (true) when the element represents a directory. If the element represents a file, the value is .F. (false)

- :Permissions: A character string with the Unix file or directory permissions or NIL when the server is not a Unix system.

- :Owner: A character string specifying the Unix owner of the file or directory element or NIL when the server is not a Unix system.

- :Group: A character string specifying the Unix group of the file or directory element or NIL when the server is not a Unix system.

Description

The method :directory() retrieves a listing of files and optionally directories from the SFTP server.

In case of error an empty array is returned. Use :getLastError() and :getLastMessage() methods to obtain detailed error information.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.