inheritance - Batch script to enforce inheritence on 3rd level folders -
this kind of interesting problem, please bear me here:
i have 3 levels of nested folders used syncing files end-user devices - on first level administrator has permissions, on second level end-users have (explicit & individual) permissions, , on third level there content (files , more folders).
the problem arises when (occasionally) content being moved third level not inherit permissions folder above - our users end content in directories don't have permissions (and so, cannot sync data).
to remedy trying write batch script (to run on daily schedule) digs third level folders , resets inheritance flag on acls there. important script not touch permissions on second level folders (since remove explicit rights end-users).
here script working (yes it's simple):
set base=c:\testprivate set subfolders=.\* /r %base% %%a in (.) ( icacls.exe %subfolders% /reset /t ) exit /b
the problem script i'm trying build resets permissions on (including second level) below whatever directory working on.
is there flag or variable can use takes working directory of /r flag , feeds %subfolders%, icacls processes on third level folders?
try , remove echo
if output ok:
@echo off &setlocal pushd "c:\testprivate" /f "delims=" %%i in ('dir /a /b /s^| findstr \\.*\\.*\\.*\\') echo icacls.exe "%%~fi" /reset /t popd
Comments
Post a Comment