SocketTools .NET Edition

FileTransfer.GetFileList Method (String)

Returns an unparsed list of files in the current working directory.

[Visual Basic]
Overloads Public Function GetFileList( _
   ByRef fileList As String _
) As Boolean
[C#]
public bool GetFileList(
   ref string fileList
);

Parameters

fileList
A string buffer passed by reference that will contain the file list data when the method returns.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The GetFileList method returns a list of files in the current working directory on the server, copying the data to a string buffer. Unlike the GetFirstFile and GetNextFile methods that parses a directory listing, this method returns the unparsed file list data. The actual format of the data that is returned depends on the operating system and how the server implements file listings. For example, UNIX servers typically return the output from the /bin/ls command.

This method can be particularly useful when the client is connected to a server that returns file listings in a format that is not recognized by the component. The application can retrieve the unparsed file listing from the server and parse the contents.

This method is supported for both FTP and SFTP (SSH) connections, however the format of the data may differ depending on which protocol is used. Most UNIX based FTP servers will not list files and subdirectories that begin with a period, however most SFTP servers will return a list of all files, even those that begin with a period.

This method will cause the current thread to block until the file listing completes, a timeout occurs or the operation is canceled.

See Also