Deletes a directory from the FTP server.
Namespace: Jscape.FtpAssembly: 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#
Copy

myFtp.DeleteDir("newDir", false);

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#
Copy

myFtp.DeleteDir("newDir", true);

myFtp.DeleteDir("newDir", True)
Exceptions
Exception | Condition |
---|---|
Jscape.Ftp..::..FtpException | If an I/O or FTP error occurs. |