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.

有帮助吗?

解决方案

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top