wmannix
asked on
Put Search results into a CSV file
Is there a way to do a search of local drives and put the result into a csv file?
I want to fild all files on local drives larger than 20mb.
I need to have filename, size, modified, location
I want to fild all files on local drives larger than 20mb.
I need to have filename, size, modified, location
Yes, it can be done. VBScript or a batch file could probably do it the easiest. Batch file would use the FSUTIL command to get the list of local drives, then use a DIR command in a FOR /F loop to build your CSV file with %~z for size and %~t for modified timestamp of the file. I doubt you will find somebody to write the code for 50 points, though.
ASKER
It's a fairly important problem for us. Re-assessed point value. I'm new to this, and not sure how the whole point thing works.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here's a simple FREE program that will find all files matching your specifications (> 20 MB):
http://www.freebyte.com/disktective/
This one's not free, but does have a free trial version -- and will export to Excel format (as you asked for):
http://www.spadixbd.com/dsm/index.htm
http://www.freebyte.com/disktective/
This one's not free, but does have a free trial version -- and will export to Excel format (as you asked for):
http://www.spadixbd.com/dsm/index.htm
ASKER
I'm more apt to go w/ the batch file option so I don't have to install anything on the servers...
I do have one question though:
Is
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
fsutil fsinfo drivetype %%a: | findstr -i fixed && call :SearchDrive %%a
)
to identify the local drive letter? or is that for networked drives?
Thanks for all the rapid responses folks.
I do have one question though:
Is
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
fsutil fsinfo drivetype %%a: | findstr -i fixed && call :SearchDrive %%a
)
to identify the local drive letter? or is that for networked drives?
Thanks for all the rapid responses folks.
ASKER
Also....
I just ran the batch job...
I have results. It's great. But. I have no file extensions. I have the option on in explorer to view them, and system files. But it doesn't have them in the resultant data.
I just ran the batch job...
I have results. It's great. But. I have no file extensions. I have the option on in explorer to view them, and system files. But it doesn't have them in the resultant data.
Hi, Wmannix. The FOR loop you asked about is to detect the drive type of each drive letter and only run on local drives (not network).
Sorry about the missing file extensions. That was an oversight on my part. Use the following as a replacement for the 2nd FOR loop (just had to add the extension modifier):
for /f "tokens=*" %%d in ('dir %1:\ /s /a-d /b') do if %%~zd GTR %SearchSize% echo %%~nd%%~xd,%%~zd,%%~td,%%~ dd%%~pd >>%Output%
If have any other questions, just let us know.
Sorry about the missing file extensions. That was an oversight on my part. Use the following as a replacement for the 2nd FOR loop (just had to add the extension modifier):
for /f "tokens=*" %%d in ('dir %1:\ /s /a-d /b') do if %%~zd GTR %SearchSize% echo %%~nd%%~xd,%%~zd,%%~td,%%~
If have any other questions, just let us know.
ASKER
Not a problem. Thanks for the extra info.
That worked out perfectly.
This will search all local drives at once. Correct?
thanks again.
-W
That worked out perfectly.
This will search all local drives at once. Correct?
thanks again.
-W
Yes, all local drives in that one command, and the results of all drives go to the same output file.
ASKER
thanks!
You're welcome.
ASKER
I just ran this on the 1st server. 'FSUTIL' is not recognized as an internal or external command, operable command or batch file.
this is 2000 server.
I have copied fsutil.exe from my XP pro machine to a server (Non Production) and the searchdrives does work.
Will there be adverse affects using fsutil on the 2k box?
this is 2000 server.
I have copied fsutil.exe from my XP pro machine to a server (Non Production) and the searchdrives does work.
Will there be adverse affects using fsutil on the 2k box?
I don't think there will be any adverse affects. The FSUTIL is included with Windows XP, Windows 2003, but MS came out with the utility after the release of Windows 2000. It should work fine.
ASKER
I found a KB article (about 3 min ago) that uses FSUtil from 2k3 or XP to complete a chkdsk function on a 2k server. So MS supports the use of it in 2k.
Thanks.
Thanks.