We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

FTP - delete non-empty directory


It would be nice to have a method to force-delete non-empty directories via ftp. Right now, we have to recursively delete all files and directories which is a bit of a pain.

For anyone interested, here’s the code to delete recursively:

private static void DeleteDirectory(string path)
Aspose.Network.Ftp.ListItem[] list = client.ListDirectoryDetails();
for (int i = 0; i < list.Length; i++)
if (list[i].ItemType == Aspose.Network.Ftp.ListItemType.File)
client.Delete(path + “/” + list[i].Name);
else if (list[i].ItemType == Aspose.Network.Ftp.ListItemType.Directory)
DeleteDirectory(path + “/” + list[i].Name);


Thank you for your inquiry and sample code.

I agree with you that recursively deleting the items from any directory can lead to performance penalty depending upon the number of file. But I am afraid, at the moment we do not have such functionality as required by you.

We will discuss this with our development team to check if we can add your required feature in our roadmap.


Hi again,

We have logged your request in our tracking system under ticket Id 32399. As soon as this feature is available, we will let you know here.

Thank you,
Hi Henri,

Please accept out apology for such a delayed response.

I would like to share that Aspose.Network is no more supported and has evolved into Aspose.Email for .NET. Therefore these issues are being closed and will no more be addressed by the development team.

Please feel free to write us back if you have any other query related to Aspose.Email for .NET.