I have a problem very curiosity.
I am delete files into folders this is the algoritm
System.IO.DirectoryInfo di = new DirectoryInfo(folderPath);
foreach (FileInfo file in di.GetFiles())
{
file.Delete();
}
foreach (DirectoryInfo dir in di.GetDirectories())
{
dir.Delete(true);
}
I choose the directory and the algorithm deletes: folders, subfolders and everything related without problem.
The problem occurs when I download a compressed file, which has folders and subfolders (it is important to mention, that the data in the compressed file is what I should actually delete).
and the software reports an error: Access denied
The truth is that I do not understand, the files of that compressed (.zip) specifically some folders of that compressed file are the ones that will not let me delete.
Is there something missing in the algorithm that allows deletion?