Deletes a directory from the FTP server.

Namespace: Jscape.Ftp
Assembly: Jscape.Ftp (in Jscape.Ftp.dll) Version: 2.4.5.0

Syntax

C#
public void DeleteDir(
	string remoteName,
	bool recurse
)
Visual Basic
Public Sub DeleteDir ( _
	remoteName As String, _
	recurse As Boolean _
)
Visual C++
public:
void DeleteDir(
	String^ remoteName, 
	bool recurse
)

Parameters

remoteName
Type: System..::..String
The directory to delete.
recurse
Type: System..::..Boolean
true if files and sub-directories should be deleted, false otherwise.

Remarks

The DeleteDir method deletes all files in the directory and the directory itself. If the directory is not empty after this (contains subdirectories) then an FtpException is thrown. Set the recurse parameter to true to delete all files and sub-directories, false otherwise.

Examples

This example removes the sub directory newDir on the FTP server. The directory removed is relative to the current remote directory. It assumes that the directory to remove already exists and is empty.
CopyC#
myFtp.DeleteDir("newDir", false);

Copy 
myFtp.DeleteDir("newDir", False)

Examples

This example removes the sub directory newDir on the FTP server and all files and sub-directories. The directory removed is relative to the current remote directory. It assumes that the directory to remove already exists.
CopyC#
myFtp.DeleteDir("newDir", true);

Copy 
myFtp.DeleteDir("newDir", True)

Exceptions

ExceptionCondition
Jscape.Ftp..::..FtpExceptionIf an I/O or FTP error occurs.

See Also