In the root of my drive there exists a folder called SourceControl
that contains all the working copies of all my programming projects.
I would like to move the folder to my user directory (\Users\Me
), but something about the permissions on the folder forbids me. I don't remember how I created the folder.
When I execute the move command:
MOVE \SourceControl \Users\Me
I receive the following error:
Access is denied.
I have resolved a similar problem in the past using the Takeown
utility to assign ownership of the file to me, so I tried this command next:
TAKEOWN /F \SourceControl
It returns the following error:
ERROR: The current logged on user does not have ownership privileges
on the file (or folder) "C:\SourceControl".
I've just learned about the Icacls
utility, which can inspect and modify file permissions.
I used this command to inspect the permissions on the folder:
ICACLS \SourceControl
It produced this list:
\SourceControl BUILTIN\Administrators:(I)(F)
BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
NT AUTHORITY\SYSTEM:(I)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
I think this means that normal user accounts, like mine, have permission only to read and execute (RX
) here, while administrator accounts have full control (F
).
I used Icacls to confer full control of the directory to my user account with this command:
ICACLS \SourceControl /grant:r Me:F
The command produces this output:
processed file: \SourceControl
Successfully processed 1 files; Failed processing 0 files
Now inspection of the permissions produces this output:
\SourceControl Domain\Me:(F)
BUILTIN\Administrators:(I)(F)
BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
NT AUTHORITY\SYSTEM:(I)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
But after this the move command still fails with the same error.
Is it possible to move this folder without invoking administrator rights? If not, how should I do it as administrator?
Best Answer
Sounds like you probably have open file handles to stuff in there. Kill any of your programs that might be using it. Reboot in safe mode if you have to.
If you're still having problems, there's a sysinternals tool called handles that can help you as well.