Xceed .NET Libraries Documentation
DeleteFolder(String,Boolean) Method


Xceed.Ftp Assembly > Xceed.Ftp Namespace > FtpClient Class > DeleteFolder Method : DeleteFolder(String,Boolean) Method
The name of the folder to delete. Some FTP servers may be case-sensitive!
true if each item in the folder should also be deleted; false otherwise.
Deletes a folder, and optionally each item in the folder, from the FTP server.
Syntax
'Declaration
 
Public Overloads Sub DeleteFolder( _
   ByVal folder As String, _
   ByVal recursive As Boolean _
) 
'Usage
 
Dim instance As FtpClient
Dim folder As String
Dim recursive As Boolean
 
instance.DeleteFolder(folder, recursive)
public void DeleteFolder( 
   string folder,
   bool recursive
)

Parameters

folder
The name of the folder to delete. Some FTP servers may be case-sensitive!
recursive
true if each item in the folder should also be deleted; false otherwise.
Exceptions
ExceptionDescription
Cannot perform the requested operation because the FTP client is in an invalid state.
The format of the reply received from the FTP server was not recognized..
An I/O error has occurred.
A fatal FTP-specific error has occurred..
Remarks

By default, the folder will be deleted from the current working folder. If you want to delete the folder from another location, 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.

Some FTP servers will allow folders that contain child items to be deleted, therefore, it is possible that calling this overload of the DeleteFolder method with its recursive parameter set to false will still delete each item in the folder (including the folder).

The DeleteFolder method will send the RMD command and optionally the PWD, CWD, TYPE, PASV or PORT and LIST commands to the FTP server.

This method is the equivalent of the RemoveFolder method 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