Jump to content

Automatically clear file permissions?


dboone

Recommended Posts

I run a small computer repair shop. I often have to transfer data between hard drives due to a reformat or upgrade. During which I sometimes run into problems with file permissions that are set on directories or files from previous user accounts. I can sometimes override these setting by forcing new ownership through windows security settings however it doesn't always work right or doesn't change all the sub directories.

I would love to find a way to automatically clear all previous permissions and force new ones. A batch files would be great but all I can find so far are ones that remove file attributes.

Any Ideas from all you wonderful and knowledgeable people would be greatly appreciated.

- I need something that will work with both XP Home and Pro

Thx, Darin

Edited by dboone
Link to comment
Share on other sites


FOR %%i IN (*.*) DO cacls "%%i" /T /C /P "%USERNAME%":F

or

cacls *.* /T /C /P "%USERNAME%":F
xcacls *.* /T /C /Y /P "%USERNAME%":f

Cacls is included in WXP, Xcacls is part of some reskit and can be downloaded.

Xcacls can use the /Y switch which makes it possible to replace rights without verifying (read more on the site Joc mentioned).

I'm not sure, but it may be possible to use only the second command.

It may also be possible to replace "%USERNAME%" with a group name (e.g. administrators) or *.*/everyone.

I use cacls to give me full rights to the "System Volume Information"-folder in order to remove it (permanently).

Edited by DL.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...