Find a File

  • Thread starter Thread starter Victor Pereira
  • Start date Start date
V

Victor Pereira

Hi,

I want to find every file owned by the user foobar. How can i do it ?

Thanks in advance,

Victor Pereira
 
Hi,

I want to find every file owned by the user foobar. How can i do it ?

Thanks in advance,

Victor Pereira
Owner foobar c:\reportfile.txt c:\ D:\
Acutually, foobar should be "Computername\foobar" or "domainname\foobar" or "builtin\administrators", etc...

Owner.bat contains:
@echo off
if {%3}=={} @echo Syntax: Owner UserID ReportFile Path1 [Path2 ... PathN]&goto :EOF
setlocal
set owner=%1
set owner=%owner:"=%
set report=%2
if exist %report% del /q %report%
set fo=Findstr /L /I /C:"%owner%"
:loop
if {%3}=={} goto finish
for /f "Tokens=*" %%f in ('dir %3 /b /s /a-d') do (
for /f "Tokens=*" %%o in ('dir /q "%%f"^|%fo%') do (
@echo "%%f">>%report%
)
)
shift
goto :loop
:finish
endlocal


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top