System.IO.Directory.Move(tempPath, newFolder) throws exception access denied
-
21-07-2021 - |
Domanda
I am trying to move a folder from one directory to another using this
System.IO.Directory.Move(tempPath, newFolder);
I am Administrator on my computer, so I should have full access. I cannot figure out why I get this exception once every two trying.
Access to the path 'D:\<myDirectory>' is denied.
Soluzione
Just because you're admin doesn't mean you can access everything. Among the things you can't necessarily access:
- Files/directories owned by SYSTEM which don't explicitly allow admins (e.g. C:\System Volume Information)
- Files locked by other processes with "share" settings which preclude your access
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow