1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| @echo off
setlocal enableextensions enabledelayedexpansion
chcp 1252 >nul
set arbo=mon arbo
cd /d %arbo% || exit /b 1
for /f "tokens=1,*" %%A in (C:\SCRIPTS\test.txt) do (call :correspondance %%A "%%~B")
echo. & pause
exit /b 0
:correspondance
set match=0
for /f "tokens=*" %%J in ('dir /b /ad /s') do (
if !match! NEQ 1 (if /i "%%~nJ"=="%1 %~2" (
set match=1
call :creation_acl %1 "%%~J"
)
)
)
goto :eof
:creation_acl
icacls "%~2" /grant:r groupe_%1_ETABLISSEMENT:(OI)(CI)(RX) /inheritance:e
:creation_acl_dossier
icacls "%~2\%dossier_1%" /grant:r groupe_%1_ETABLISSEMENT:(OI)(IO)(RX) /T
icacls "%~2\%dossier_1%" /grant:r groupe_%1_ETABLISSEMENT:(CI)(RA,RD,X,GR,WD)
icacls "%~2\%dossier_1%" /grant:r groupe2:(CI)(RA,RD,X,GR,WD)
icacls "%~2\%dossier_1%" /grant:r groupe3:(OI)(IO)(M,DC)
goto :eof |
Partager