How would I change every folder in a drive that says "Design" to only have read permissions for "Domain Users" group? I have messed around with some for loops using cacls but cant seem to get it working quite right.

Hey Rocky3598, I can help you with this if you still need it. We can use findstr on dir output to create a list of folders containing the word "design". Then we can use a for loop on that list to cacls the permissions. Let me know if you still want help.
Yes i would still like help. I also thought I would need to use a for loop but im not quite sure how to make it search through directories and change permissions.
Rocky3598, Ok here's a start... the cacls command is incomplete though. Do you already have the cacls command you want?
@echo off
setlocalREM removing old tmp files
del /q dir.tmp
del /q dirclean.tmpREM create list of folders containing keyword "design"
dir /ad /b > dir.tmp
findstr /l /i "design" dir.tmp > dirclean.tmpREM loop through list and apply permissions
for /i "tokens=*" %%a in (dirclean.tmp) do (
cacls %%a ....
)
endlocal
I like that! Is there anyway to make it search through sub directories also? Possibly using tree?
Yes. If we add a /s to the first dir command, it will search through the directory it is running in, and all subdirectories as well. If we used tree, I would have to create a module to clean up all of the tree structure lines.
Ok thats what I was also thinking i just wanted to make sure that it would work with the exact path now. Thank you for the help it has made this process way faster
