Method FTPClient():directory() Professional

Fills an array with information about the files in a specified path.

:directory( [<cDirectory>], [<cAttribute>] ) --> aDirectory
<cDirectory> is a character string specifying the drive, path and file from which file information is read into an array. A file mask can be defined by using "wildcards" (* or ?) as part of the file name. If no <cDirectory> is specified, "*" is used, and all file information in the current path is read.
The argument <cAttribute> is a string which can be used to extend the files placed in the array based on their file attributes. <cAttribute> may specify one or more of the following characters: "D","H","S". The meaning of the valid characters for <cAttribute> is as follows:
File attributes for directory
Attribute Meaning Description
D Directory directories are also listed
H Hidden hidden files are also listed
S System system files are also listed

The return value of the :directory() method is a two dimensional array containing information about one of the files specified by <cDirectory> in each subarray. The array columns can be identified using symbolic constants defined in the Header file "". The contents of each array column are given in the following table:

Columns in the return array
Constant Contents data type
F_NAME file name C
F_SIZE size of the file N
F_WRITE_DATE date of last update D
F_WRITE_TIME time of last update C
F_ATTR file attribute C
F_EA_SIZE size of the extended file attributes N
F_CREATION_DATE date of creation D
F_CREATION_TIME time of creation C
F_ACCESS_DATE date of last opening D
F_ACCESS_TIME time of last opening C

When <cDirectory> contains an invalid path or file specification, or no matching files are found, an empty array ({}) is returned. If information on a file cannot be provided by the remote filesystem, the corresponding array element is empty.


The method :directory() provides file information about all or a specific type of files in the specified path on the FTP server.


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.