I'm trying to delete a folder and all files and folders within that folder, I'm using the code below and I get the eror "Folder is not empty", any suggestions on what I can do?
var dir = new DirectoryInfo(@FolderPath);
dir.Attributes = dir.Attributes & ~FileAttributes.ReadOnly;
catch (IOException ex)
dir.Delete(true); // true => recursive delete