JSI Tip 1255. Grant a user Full Control on files that they own in a common folder.
Jerold Schulman
April 22, 1999
1 Min Read
In tip 1254, we granted users Full Control on files in their own folder (JSIFCUAll) or to all files in a specified folder (JSIFCU).
To grant users Full Control on files that they own in a common (specified) folder, we need to determine ownership.
To perform the subject task:
JSIFCOwner Folder DomainName
JSIFCOwner.bat contains:
@echo offif NOT {%2}
{} goto begin:syntax@echo Syntax: JSIFCOwner Folder DomainNamegoto end:beginsetlocalset folder=%1set folder=%folder:"=%if not exist "%folder%*.*" goto syntaxset domain=%2set domain=%domain:"=%for /f "Tokens=*" %%i in ('dir /b /a-d /s "%folder%"') do call :files "%%i"endlocalgoto end:filesset file=%1for /f "Tokens=1*" %%i in ('subinacl /noverbose /file %file%') do call :doit "%%i" "%%j"goto end:doitif /i not %1
"/owner" goto endset user=%2set user="%user:~2,99%set work=%user%set work=%work:"=%for /f "Tokens=1 Delims=" %%i in ('@echo %work%') do set auth=%%iif /i not "%domain%"=="%auth%" goto endCACLS %file% /E /C /P %user%:F:end
NOTE: SubInACL causes this batch job to run very slowly.
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like