Jump to content

Wanted - script to change ownership on a set of folders


Recommended Posts

Posted

I need to change the ownership on a large amount of folders back to the administrator so that I can delete them. They are old redirected appdata folders.

 

However I need the option of excluding the folder 'staff' which is sitting amongst these folders.

 

Is there anything I can do with cacls or similar to achieve this? Doing it by hand will take hours.

Posted
Thanks, but won't that still apply the change in ownership to the staff folder? I need the script to ignore that folder all together.
Posted

Ok assuming you want to do this on windows from the cacls ref, you could try the following:

 

you want to achive changing all security settins apart from any folder called staff.

 

1) Use window search function to find all folders called staff.

2) Select all staff folders and bring up the properties.

3) Go to the security tab, click advaced

4) untick Inherit from parent folder, click ok, close search box

5) Now any security you set higher up the tree will not filter to these sub folders.

6) On the folders at the top of the tree set the security settings you want to apply.

 

Hope this helps.

  • Thanks 1
Posted

If you do go the scripty route, just call the above many times for each folder you want to change (except the one you don't). There's various ways of getting folder names out nice and quick (if they're all conveniently on the same computer in the same master folder a dir /b /ad > c:\folders.txt will do you nicely.

 

Or you could use the method as mentioned above, depends what you need really :p

  • Thanks 1

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



×
×
  • Create New...