4D Internet Commands v14

FTP_GetDirList

Home

 
4D Internet Commands v14
FTP_GetDirList

FTP_GetDirList 


 

FTP_GetDirList ( ftp_ID ; directory ; names ; sizes ; kinds ; modDates ; modTimes ) -> Function result 
Parameter Type   Description
ftp_ID  Longint in Reference to a FTP login
directory  Text in Unix directory pathname
in Current directory
names  String array in List of Names
sizes  Longint array in List of Sizes
kinds  Integer array in 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 in List of Modification Dates
modTimes  Longint array in List of Modification Times
Function result  Integer in Error Code

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 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 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.

 
PROPERTIES 

Product: 4D Internet Commands
Theme: IC File Transfer
Number: 88944

 
HISTORY 

Modified: 4D Internet Commands 2003

 
SEE ALSO 

FTP_ChangeDir
FTP_Login
FTP_PrintDir
FTP_VerifyID

 
ARTICLE USAGE

4D Internet Commands ( 4D Internet Commands v11.4)
4D Internet Commands ( 4D v13.2)
4D Internet Commands ( 4D Internet Commands v12.1)
4D Internet Commands ( 4D Internet Commands v14 R2)
4D Internet Commands ( 4D Internet Commands v14)
4D Internet Commands ( 4D Internet Commands v14 R3)
4D Internet Commands ( 4D Internet Commands v14 R4)