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 the following code in a file called permissions.bat
for /f %%g in ('dir "f:\temp\" /ad /b') do for /f %%a in ('dir %%~fg /ad /b') do icacls
"%%~fg\%%a" /grant:r domain\mygroup:(OI)(CI)M
This works fine but for Client and Subfolders that contain spaces it doesnt work. For example
Folder1\Client1\Sub Folder 1
Would show up as
Closely followed by System cannot find the file specified error. Any ideas?
This is running on a 2003 Server by the way.
Thanks for looking