Looking for some help with a batch file I need to run urgently to set permissions on a number of folders.
We have the following folder structure
Then within each client folder we have several sub folders
I need to reset permissions on all the Subfolders in the example above and have written the following code in a file called permissions.bat
for /d /r %%g in ("f:\Folder1") DO icacls "%%g" /grant:r domain\mygroup:(OI)(CI)M
This gives the modify permission to the AD group domain\mygroup to the folder Client1 and Subfolder1. The permissions of Client1 are different and should not be changed as users should not be able to delete/edit client folders. How can I modify the batch file to only apply the icacls command to the SubFolders under each Client folder rather than it applying to the Client folder and the Subfolders.
I am sure it will be something simple but everything I have tried doesnt seem to work. Nested For Loops maybe or is For the wrong command?
This is running on a 2003 Server by the way.
Thanks for looking