Mojoman317717
Mojoman317717

Reputation: 31

How to set acl permissions for specific sub-folders in many paths?

Here is an example folder path: E:\Datastore\MarcStone Bids\7401-7450\7415 Building Renovation and Addition for Van Meter Community School District - Van Meter IA\Bid Documents

Note how the second to last directory is a job #/name. I have hundreds of these paths on a windows 2008 r2 server. Inside each one exists the exact same group of 10 folders which are created by a script. They inherit their parent permissions which is fine, EXCEPT for 3 of the 10 folders require a single additional acl permission. I want to add this additional permission through a script of some kind. I've looked at vbscript, but it seems wildcards in folder paths is a complication that is better handled by powershell, but I'm really not sure.

So, I would appreciate counsel on choosing a method to perform this action and then more importantly help to build a working script.

Thoughts??

Upvotes: 1

Views: 874

Answers (1)

Trigger
Trigger

Reputation: 691

Your simple answer lays in command line tools.

Type icacls /? and for /?

Using the dir command can give you a list of folders matching.

dir *partialfoldername* /ad /s /b

Putting it into a for loop.

for /f %A in ('dir *partialfoldername* /ad /s /b) do icacls %A /grant Administrator:F

Upvotes: 1

Related Questions