Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving SEARCH results into a text file? (filename, dir, date, size)

Status
Not open for further replies.

VBAguy22

IS-IT--Management
Aug 5, 2003
180
CA
Hello all,
does anyone know how to save Windows 2000 SEARCH results into a text file? I have been fiddling around with it for an hour now. We are trying to clean a LAN disk and need a list of old files (1999 and earlier) over 10 megs. Is there a good DOS command to display files by the criteria above?

Thanks
 
Have you explored XXCOPY?

It has multiple data parameters, as well as a SZ parameter for filtering on file or directory size.

It can be used in a non-copy situation as a very effective file lister and can be redirected to a .txt file, or you can use the built-in logging.

Freeware:
Be sure to read the application notes.
 
sendto works, but it only copies the file name, i also need to copy the size and date modified of the file...i can not select those using Ctrl+A

 
How about From a CLI type:

dir *.* /s /o:d > dir.txt

where
do a 'dir' of all files
/s = including all sub directories
/o:d = order by date
> = redirect
dir.txt = name of file to write info too

The oldest files will be listed first..

Peace.. -<-* Lynlee

 
Or do a screen capture. Alt-<Print Screen> and paste it to Paint or any graphic program you use and crop it down to size.
 

PS. :)

You can send it strait to the printer too with:
dir *.* /s /o:d > prn
Before printing, I would send it to standard output
to be certain it is what I expected before wasting a
lot of paper..
dir *.* /s /o:d |more
&quot;|more&quot; Piping to 'more' will allow you to quickly
page thru the output via the monitor.

I think I got it all this time.. Sorry for the
brevity of my first post..

Peace.. -<-* Lynlee
 
Thanks Lynlee!
What if I want the oldest files AND at the same time files that are greater than 20mb? (For LAN drive clean)
I mean, I don't want it to output all the files, only the ones I need.
 
Hello VBAguy22..

No, you can not sort by 2 parameters.. Only the first typed parameter would be acted on.. IE: say I typed this command:
dir *.* /s /o:-s /t:w |dir.txt
/o = sort Order
:-s = size (largest first)
/t = time
:w = last time written to
OR
:a = last time accessed (this may be the one you want)

(Side Note & a Tip: YOu might wanna make your 'dir' command into a .bat file if you have a lot of partitions. Go to a CLI and type 'help dir' or help <Acommand>)

The 'dir.txt' text file would show your directory listing by SIZE, ignoring the 2nd sort parameter.

How can you have a list sorted by 2 parameters? Once the dir command hit the 2nd switch it would shuffle your perfect SIZE sort, using the 2nd parameter '/t:w', if the dir command didn't ignore the 2nd param.

ALL is not lost.. ;)

If you open a DOS box from within Windows for the dir command, your output should show up with the DATE first on each line of each file listed in your SIZE sorted 'dir.txt' file.. Take your 'dir.txt' file into a text editor with a SORT feature. Delete all files references under 20Megs. That should be easy enough since they are listed by size under each directory name.. Select/highlight all the file listings that are from 0 to 20Megs in a directory and hit the delete key. Highlight all the remaining files under that directory name, then use the 'sort' feature of your editor in that directory's listing. Since the DATE is first and TIME is the 2nd parameter, your sort will sort first by all files with the same date with time increasing, then the next date etc. Move on to the next directory and repeat.. The remaining file info is what you will want to print. Does your editor do scripts or can you create keystroke macros? If so, that could save you some repetitive work.

A note about sorting by DATE.. If your date output in the CLI is NOT with Year first, then month, then Day, you will have to set your 'Regional Settings' in 'Control Panel' to show yyyy/mm/dd, if you want it sorted by year first. Set it back after your done with your directory command and you have your 'dir.txt' file(s). Otherwise, it will sort by Month first, then day, THEN year.. IE: mm/dd/yyyy since the first characters in the line are those representing the month, day, then year.

Hmm.. That sounds complicated but if you experiment on a root's main subdirectory and all of it's subs you will see it is quicker than it sounds, but it will take time if your setup is huge..

All this information is in your OS help.

Peace.. -<-* Lynlee
 
Just an idea... import the output from dir.txt to Excel and you can do anything with it. You can also export it back to create a delete script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top