TIpClientFtp() > File methods |
Retrieves file information from the FTP server as array.
:listFiles( [<cFileSpec>] ) --> aFiles
Method :listFiles() sends the LIST command along with an optional file specification to the FTP server and returns the file information as a two-dimensional array. The following #define constants from the Directry.ch file can be used to access individual columns of the file information array:
Constants for the file information array
Constant | Position | Description | Data type |
---|---|---|---|
F_NAME | 1 | File name | Character |
F_SIZE | 2 | File size in bytes | Numeric |
F_DATE | 3 | Creation date | Date |
F_TIME | 4 | Creation time | Character |
F_ATTR | 5 | File permissions (attributes) | Character |
F_LEN+1 | 6 | Number of links to file | Numeric |
F_LEN+2 | 7 | Owner name | Character |
F_LEN+3 | 8 | Group name | Character |
The column F_ATTR contains a character string of 10 bytes. It encodes the file type in its first byte and file permissions for the owner, group and public in the following nine bytes.
File types (1st byte of F_ATTR)
Character | Description |
---|---|
- | Regular file |
b | Block special file |
c | Character special file |
d | Directory |
l | Symbolic link |
n | Network file |
p | FIFO |
s | Socket |
The next nine characters are in three groups of three bytes. They describe the permissions on the file. The first group of three describes owner permissions, the second describes group permissions, and the third describes other (or public) permissions. Because Windows systems do not support group and other permissions, these are copies of the owner's permissions. Characters that may appear are:
File permissions (byte 2-10 of F_ATTR)
Character | Description |
---|---|
r | Permission to read file |
w | Permission to write to file |
x | Permission to execute file |
t | Temporary file |
http://www.xHarbour.com