JSI Tip 1255. Grant a user Full Control on files that they own in a common folder.

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 <Drive:>\Folder DomainName

JSIFCOwner.bat contains:

@echo off
if NOT \{%2\}

\{\} goto begin :syntax @echo Syntax: JSIFCOwner Folder DomainName goto end :begin setlocal set folder=%1 set folder=%folder:"=% if not exist "%folder%\*.*" goto syntax set domain=%2 set domain=%domain:"=% for /f "Tokens=*" %%i in ('dir /b /a-d /s "%folder%"') do call :files "%%i" endlocal goto end :files set file=%1 for /f "Tokens=1*" %%i in ('subinacl /noverbose /file %file%') do call :doit "%%i" "%%j" goto end :doit if /i not %1

"/owner" goto end set user=%2 set user="%user:~2,99% set work=%user% set work=%work:"=% for /f "Tokens=1 Delims=\" %%i in ('@echo %work%') do set auth=%%i if /i not "%domain%"=="%auth%" goto end CACLS %file% /E /C /P %user%:F :end
NOTE: SubInACL causes this batch job to run very slowly.
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.