Wiki : Aspose.Network : Delete directory

I tried the following code.

Aspose.Network.Ftp.FtpClient client;
client = new FtpClient( “192.168.18.100”, 21, “anonymous”, “password” );
try{
client.Connect( true );
//Change working directory to root
client.ChangeDirectory(“Sridhar test/BackUp”);
//remove folder under the root directory
client.RemoveDirectory(“Sridhar test/BackUp”);
}
catch( Aspose.Network.Ftp.FtpException fe )
{
System.Diagnostics.Trace.WriteLine( fe.ToString() );
}

But, it shows the error as follows.
"Aspose.Network.Ftp.FtpException: Remove directory failed - 550
Sridhar test/BackUp: The system cannot find the path specified.
at Aspose.Network.Ftp.FtpClient.RemoveDirectory(String remotePath)
"

I want to delete the directory
“Sridhar test/BackUp” which is available in a Client machine.
please give me reply to solve this problem






Hi,

Please comment the client.ChangeDirectory("Sridhar test/BackUp") line for the code to work. RemoveDirectory() method considers the path according to the current directory.

Or alternatively, you can do this too.

client.ChangeDirectory("Sridhar test"); // Change the directory
client.RemoveDirectory("BackUp"); // Delete the Backup folde inside "Sidhar test" folder

Regards,
Saqib Razzaq