Deleting a remote directory |
You can delete a remote directory and optionally all sub-direcotries and files on the server using the DeleteDir method. The directory deleted is relative to your current remote directory.
Note
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.
Example
This example deletes the images directory and all files and sub-directories.
[C#]
// delete directory named images
myFtp.DeleteDir("images", true);
[Visual Basic]
' delete directory named images
myFtp.DeleteDir("images", True)
See also