Hi Everyone,
I would like to find out all the files in my File Server Store that
haven't valid ownership.
Help me please!!!
Eugene: (e-mail address removed)
OwnerInvalid DriveOrFolder ReportFile
NOTE: OwnerInvalid.bat uses ShellESC.exe from tip 8250 in the 'Tips & Tricks' at
http://www.jsiinc.com,
which must be located in a folder that is in your path.
NOTE: OwnerInvalid.bat runs a very long time.
OwnerInvalid.bat contains:
@echo off
if {%2}=={} @echo Syntax: OwnerInvalid DriveOrFolder ReportFile&goto:EOF
if not exist %1 @echo Syntax: OwnerInvalid DriveOrFolder ReportFile - %1 NOT found.&goto:EOF
setlocal
set top=%1
set RF=%2
if exist %RF% del /q %RF%
set object=%top%
set object=%object:"=%
for /f "Tokens=*" %%a in ('dir %top% /ad /q^|findstr /L /V /c:"&"^|findstr /L /c:"<DIR>"^|findstr /L /c:" ... "^|shellesc') do (
for /f "Tokens=*" %%x in ('@echo %%a#^|findstr /L /c:" .#"^|shellesc') do (
@echo "%object%" >>%RF%
)
)
for /f "Tokens=*" %%f in ('dir %top% /s /b') do (
set object=%%f
call :tree >nul 2>&1
)
endlocal
goto :EOF
:tree
for /f "Tokens=*" %%a in ('dir "%object%" /q /ad^|findstr /L /V /c:"&"^|findstr /L /c:"<DIR>"^|findstr /L /c:" ... "^|shellesc') do (
for /f "Tokens=*" %%x in ('@echo %%a#^|findstr /L /c:" .#"^|shellesc') do (
@echo "%object%" >>%RF%
)
)
for /f "Tokens=*" %%a in ('dir "%object%" /q /a-d^|findstr /L /V /c:"&"^|findstr /V /L /c:"<DIR>"^|findstr /L /c:" ... "^|shellesc') do (
for /f "Tokens=*" %%x in ('@echo %%a#^|findstr /L /V /c:" .#"^|shellesc') do (
@echo "%object%" >>%RF%
)
)
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com