Suppose I have a directory myDir
tree with many nested sub-directories. I grant full access to this directory with all its files and nested sub-directories to myUser
with command:
cacls myDir /T /E /G myUser:F
So far, so good.
Now I have a sub-directory myDir/A/B/C
which I would like to exclude from the cacls
processing. That is, I would not like to grant myUser
access to this sub-directory.
What would you suggest?
The simplest way is just to move this folder to another place before running cacls
and move it back after that. Does it make sense?
You need to generate a list of files to be processed and exclude the ones you don't want since CACLS doesn't allow filtering.
Here, I use "dir" to generate the list of files to process. You could use "forfiles" as well.
(You can make the script more compact using pipes, but I used temporary files instead just to make it more clear).