version 2003 (Modified)
FTP_GetDirList (ftp_ID; directory; names; sizes; kinds; modDates{; modTimes}) Integer
Parameter | Type | Description | |
ftp_ID | Longint | Reference to a FTP login | |
directory | Text | Unix directory pathname | |
Current directory | |||
names | Str | Txt Array | List of Names | |
sizes | Longint Array | List of Sizes | |
kinds | Longint Array | List of Kinds | |
0 = plain file, | |||
1 = directory, | |||
2 = block-type special file, | |||
3 = character-type special file, | |||
4 = symbolic link, | |||
5 = FIFO special file, | |||
6 = AF_UNIX address family socket | |||
modDates | Date Array | List of Modification Dates | |
modTimes | Longint Array | List of Modification Times | |
Function result | Integer | Error Code |
Description
The FTP_GetDirList command will retrieve a list of the objects in a directory of the FTP session identified by ftp_ID. Information on the names, sizes, types, modification dates and, optionally, modification times of the directory items is returned in arrays. A connection to the FTP site must have already been opened via FTP_Login and still valid (FTP_VerifyID). The FTP_GetDirList command changes your current working directory (CWD) to the path given and returned to the directory parameter.
ftp_ID is the long integer reference to the FTP session established with FTP_Login.
directory is a text value in the format of a HostPath which references a FTP directory. A 4D variable or field must be passed to this parameter since the resulting "current directory" will be returned. Normally, the value returned to this parameter will be the same as the value passed to it. However, there may be cases (such as access restrictions) where the directory change was not successful. In this case, the directory parameter will hold the HostPath to the session's current directory.
A null string passed in this parameter will return the current directory file list into the arrays and the current directory's HostPath into the directory parameter.
names is a string or text array to hold the name of each object in the specified directory.
sizes is a long integer array to hold the sizes of the objects in directory.
kinds is a longint array to hold the type of each object in directory. The interpretation of this value is based on the following table:
Kind | File Type |
0 | plain file |
1 | directory |
2 | block-type special file |
3 | character-type special file |
4 | symbolic link (aliases on files or folders) |
5 | FIFO special file |
6 | AF_UNIX address family socket |
Note: In the case of a symbolic link (kind=4), the FTP server returns a particular pathname (Alias name + symbol + pathname to the source file or folder). If you try to use this pathname to access source files or folders, an error will be returned. You MUST extract the pathname to the source file or folder from the string returned by FTP_GetDirList which starts just after the symbolic character. Otherwise, commands such as FTP_GetFileInfo will return the error 10085 since the file or folder will not be found.
modDates is a 4D date array to hold the last modified date for each object in directory.
modTimes is a longint array that receives the time of the last modification for each object in the directory.
Reminder: In 4D, longint arrays are used for handling time type data (each array item represents a number of seconds). Use the Time string command to convert these values into the HH:MM:SS format.
See Also
FTP_ChangeDir, FTP_Login, FTP_PrintDir, FTP_VerifyID.