Sign in with
Sign up | Sign in
Your question

Find All Files Without valid Owner

Last response: in Windows 2000/NT
Share
Anonymous
January 2, 2005 8:15:43 AM

Archived from groups: microsoft.public.win2000.file_system (More info?)

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: zeniab@gmail.com

More about : find files valid owner

Anonymous
January 2, 2005 3:23:32 PM

Archived from groups: microsoft.public.win2000.file_system (More info?)

On 2 Jan 2005 05:15:43 -0800, zeniab@gmail.com (Eugene Blokh) wrote:

>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: zeniab@gmail.com

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
Anonymous
January 2, 2005 5:32:06 PM

Archived from groups: microsoft.public.win2000.file_system (More info?)

On 2 Jan 2005 05:15:43 -0800, zeniab@gmail.com (Eugene Blokh) wrote:

>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: zeniab@gmail.com


I found so bugs. Here is a new version that works:

@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 ENABLEDELAYEDEXPANSION
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:" ... "^|shellesc') do (
set line=%%a
for /f "Tokens=*" %%x in ('@echo !line:~46!#^|findstr /L /c:" .#"^|shellesc') do (
@echo "%object%" >>%RF%
)
)
for /f "Tokens=*" %%f in ('dir %top% /s /b /ad') do (
call :treeD "%%f" >nul 2>&1
)
for /f "Tokens=*" %%f in ('dir %top% /s /b /a-d') do (
call :treeF "%%f" >nul 2>&1
)
endlocal
goto :EOF
:treeD
for /f "Tokens=*" %%a in ('dir %1 /q /ad^|findstr /L /V /c:"&"^|findstr /L /c:" ... "^|shellesc') do (
set line=%%a
for /f "Tokens=*" %%x in ('@echo !line:~46!#^|findstr /L /c:" .#"^|shellesc') do (
@echo %1 >>%RF%
)
)
goto :EOF
:treeF
for /f "Tokens=*" %%a in ('dir %1 /q /a-d^|findstr /L /V /c:"&"^|findstr /L /c:" ... "^|findstr /I /L /c:"%~nx1"^|shellesc') do (
@echo %1 >>%RF%
)


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
!