I do this in my code:
Directory.Delete(MapPath("..\\Directory1"),true);
Now I got this error:
System.IO.IOException: The directory is not empty.
What do I wrong anyone a idea?
I do this in my code:
Directory.Delete(MapPath("..\\Directory1"),true);
Now I got this error:
System.IO.IOException: The directory is not empty.
What do I wrong anyone a idea?
try to delete all files and folders inside the directory you want to delete and then delete the directory.
System.IO.DirectoryInfo projectDetailsInfo = new DirectoryInfo(pathofyourdirectory);
foreach (FileInfo file in projectDetailsInfo.GetFiles())
{
file.Delete();
}
foreach (DirectoryInfo dir in projectDetailsInfo.GetDirectories())
{
dir.Delete(true);
}
Directory.Delete(path);
hope this will help you.