Hi.
I have placed some file i a folder: Path.GetTempPath() + "TempInstallerCheckoutFolder".
When I try to delete the folder with: System.IO.Directory.Delete(Path.GetTempPath() + "TempInstallerCheckoutFolder", true);
I get a "UnauthorizedAccessException" saying: "Access to the path 'entries' is denied".
What can I do to delete this folder?
Best regards
Peter
Dusan TkacPosted Dec 12, 2008, 11:05 AM
the file you have placed in your directory is probably read-only.
You can check and set file attributes this way:
FileInfo newFileInfo = new FileInfo(newFileName);
if ((newFileInfo.Attributes & FileAttributes.ReadOnly) > 0)
{
Console.WriteLine("File is readonly.");
newFileInfo.Attributes ^= FileAttributes.ReadOnly;
}
Cheers,
Dusan Tkac