Internet Direct (Indy)
Home
PreviousUpNext
TIdFTP.List Method (string, Boolean)

Retrieves a list of files and directories on the FTP server.

Pascal
procedure List(
    const ASpecifier: string; 
    ADetails: Boolean = True
); overload;
Parameters 
Description 
ASpecifier 
File mask for the listing. Default value is ''.
 
ADetails 
Include file details. Default value is True. 

List is an overloaded procedure used to request a list of files or directories in the current directory on the FTP server. 

ASpecifier is a String value that contains a mask indicating the files and/or directories to be included in the listing. ASpecifier can contain common wildcard characters like '*' and '?'. Some useful masks include: 

 

Mask 
Usage 
 

.

 

All files in the current directory. 
All directory entries in the current directory. 
*. 
All files regardless of extension in the current directory. 
A??.txt 
All text files that have a 3-character name starting with the letter 'A'. 

 

ADetails is a Boolean value that indicates if the list should contain details about the files and directories that match the mask in ASpecifier. 

List calls the overloaded List method using an Unassigned (Nil) value for the storage of the textual responses that make up the directory listing. 

If CanUseMLS contains True, the ExtListDir is called to capture and store the results of the FTP MLSD command in the ADest parameter variable instead of the LIST or NLST commands. No additional processing is performed in the List method under this circumstance, and the method is exited. 

Prior to executing the LIST command, the TransferType for the control channel is set to ftASCII. While this is not a requirement of the FTP protocol, it is a common practice in most FTP clients. The previous value of the TransferType property is restored before exiting from the List method. 

Textual responses to the FTP command are captured and stored in the ListResult property. The value of the UsedMLS property is set to False to indicate that the MLST parser should not be used on textual values in the ListResult property. 

List will clear any existing entries found in the DirectoryListing property, and free the collection used for the structured directory listing. The collection is recreated and values in the ListResult are parsed into collection items on the initial read access to the DirectoryListing property.

ListResult 

DirectoryListing 

List 

CanUseMLS 

UsedMLS 

ExtListDir 

TransferType

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.