Topic Path: Symbol Reference > Classes > TIdFTP Class > TIdFTP Methods > List Method > List Method (TIdStrings, string, Boolean)
ContentsIndexHome
PreviousUpNext
TIdFTP.List Method (TIdStrings, string, Boolean)

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

procedure List(
    ADest: TIdStrings; 
    const ASpecifier: string = ''; 
    ADetails: Boolean = True
); overload;
Parameters 
Description 
ADest 
List for files and directories in the current directory.
 
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 or specified directory on the FTP server. 

ADest is a TIdStringList argument used to store the raw text values returned from the FTP server directory listing. 

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

 

Please note that the actual use and meaning of a wildcard character is dependent on the file system implmented on the remote FTP server. There is no universal definition for any one particular wildcard character. 

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

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. 

When ADetails is False, only the file or directory name is returned in the ADest string list using the FTP NLST command. When ADetails is True, List can return FTP server-dependent details including the file size, date modified, and file permissions for the Owner, Group, and User using the FTP LIST command. 

Prior to executing the LIST or NLST commands, 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 both the ADest parameter variable and 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.

[Delphi]

  AFiles := TIdStringList.Create;
  AFtp.List(AFiles, '*.zip', True);

  if AFtp.DirectoryListing.Count <> 0 then
  begin
  FillDirListView(AFtp.DirectoryListing)
  end;

ListResult 

DirectoryListing 

List 

CanUseMLS 

UsedMLS 

ExtListDir 

TransferType

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.