FTP_GetDirList

4D - Documentation   Français   English   German   4D Internet Commands, Theme List   4D Internet Commands, Alphabetical List   Back   Previous   Next

version 2003 (Modified)


FTP_GetDirList (ftp_ID; directory; names; sizes; kinds; modDates{; modTimes}) Integer

ParameterTypeDescription
ftp_IDLongintReference to a FTP login
directoryTextUnix directory pathname
Current directory
namesStr | Txt ArrayList of Names
sizesLongint ArrayList of Sizes
kindsInteger ArrayList 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
modDatesDate ArrayList of Modification Dates
modTimesLongint ArrayList of Modification Times
Function resultIntegerError 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 4th Dimension 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 an integer array to hold the type of each object in directory. The interpretation of this value is based on the following table:

KindFile Type
0plain file
1directory
2block-type special file
3character-type special file
4symbolic link (aliases on files or folders)
5FIFO special file
6AF_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 4th Dimension, 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.


4D - Documentation   Français   English   German   4D Internet Commands, Theme List   4D Internet Commands, Alphabetical List   Back   Previous   Next