Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Somehow i accidentally set all the files in a subfolder to no owner and i cant seem to change all the permission. I can change one by hand by changing the owner then setting permissions but how can i change owner of all the files in this directory at once?

share|improve this question
add comment

5 Answers

up vote 38 down vote accepted

Use takeown from the command prompt to take ownership a folder, all its subfolders and files recursively:

takeown /f "c:\folder\subfolder" /r
share|improve this answer
add comment

Note that cacls is deprecated (since Windows Vista?) and it advises you to use icacls.

This command will recursively reset the permissions on a folder:

icacls "C:\path\to\folder" /reset /T
share|improve this answer
add comment

You can use cacls from the command prompt:

cacls "C:\path\to\folder" /E /T /C /G "Administrator":F

The /T switch allows it to function recursively. Replace Administrator with the user you wish to give permissions to.

share|improve this answer
add comment

To fix really broken permissions, the best is to run these two commands one after the other:

takeown /f "C:\path\to\folder" /r
icacls "C:\path\to\folder" /reset /T

The first one will give you ownership of all the files, however that might not be enough, for example if all the files have the read/write/exec permissions set to "deny". You own the files but still cannot do anything with them.

In that case, run the second command, which will fix the broken permissions.

share|improve this answer
add comment

To fix really broken permissions, the best is to run these two commands one after the other:

takeown /f "C:\path\to\folder" /r icacls "C:\path\to\folder" /reset /T

The first one will give you ownership of all the files, however that might not be enough, for example if all the files have the read/write/exec permissions set to "deny". You own the files but still cannot do anything with them.

In that case, run the second command, which will fix the broken permissions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.