Xceed .NET Libraries Documentation
GetFolderContents(String) Method


Xceed.Ftp Assembly > Xceed.Ftp Namespace > FtpClient Class > GetFolderContents Method : GetFolderContents(String) Method
The file mask of the remote files to retrieve. This parameter can include a filtering mask to limit the files that are retrieved. For example, if System.String.Empty is specified, the entire contents of the current working folder will be retrieved. If "*.txt" is used, all the files in the current working folder that have the TXT extension will be retrieved. Some FTP servers may be case-sensitive!
Retrieves the contents of the current working folder.
Syntax
'Declaration
 
Public Overloads Function GetFolderContents( _
   ByVal remoteFileMask As String _
) As FtpItemInfoList
'Usage
 
Dim instance As FtpClient
Dim remoteFileMask As String
Dim value As FtpItemInfoList
 
value = instance.GetFolderContents(remoteFileMask)
public FtpItemInfoList GetFolderContents( 
   string remoteFileMask
)

Parameters

remoteFileMask
The file mask of the remote files to retrieve. This parameter can include a filtering mask to limit the files that are retrieved. For example, if System.String.Empty is specified, the entire contents of the current working folder will be retrieved. If "*.txt" is used, all the files in the current working folder that have the TXT extension will be retrieved. Some FTP servers may be case-sensitive!

Return Value

A reference to an FtpItemInfoList collection containing FtpItemInfo objects each representing a file matched by remoteFileMask.
Exceptions
ExceptionDescription
Cannot perform the requested operation because the FTP client is in an invalid state.
An error reply was returned by the FTP server.
An I/O error has occurred.
A fatal FTP-specific error has occurred..
Remarks

If you want to retrieve the contents of another folder, you could use the ChangeCurrentFolder and/or ChangeToParentFolder methods to change the current working folder. Absolute paths can also be provided, however some FTP servers might not support absolute paths and different server types may have different ways of representing absolute paths.

The current working folder can be retrieved via the GetCurrentFolder method.

The listing lines can be manually parsed or modified via the ParsingListingLine event.

If you would prefer to receive an unprocessed list of items, you can use the GetFolderContents method instead.

The TYPE command will be sent regardless of the value of the SendTypeCommand property when calling the GetFolderContents method.

The GetFolderContents method will send the LIST and PASV or PORT and TYPE commands to the FTP server.

This method is the equivalent of the GetFolderContents and ListFolderContents methods of the ActiveX version of the Xceed FTP Library.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

FtpClient Class
FtpClient Members
Overload List
Xceed.Ftp.FtpClient.GetRawFolderContents(Xceed.Ftp.Engine.FtpCommandChannel,Xceed.Ftp.Engine.ListFtpCommand)
ParsingListingLine Event