Microsoft > Microsoft DOS

DOS inexpert needs help with one little command line

(1/1)

MerryToo:
Hi
I'm trying to do a forfiles command (I think).  I want to do a listing of all files in a directory with the dates.

I usually do DIR\s\b>>  and output to a text file.  This is great, but I would like the dates.  Ideally, I'd also like to select for certain dates, too.
I tried this, which worked great:
 Forfiles /p "a:\Directory\filename with spaces" /s /d -2006-1-3 and that worked great, though I didn't try to send the output to a text file.

I tried it like this:
 Forfiles /p "a:\Directory\filename with spaces" /s /d -2006-1-3  /C “cmd c/ echo @fdate”

and like this

 Forfiles /p "a:\Directory\filename with spaces" /s  /C “cmd c/ echo @fdate”

and the command line just blinked at me, uncomprehendingly.

I want the exact syntax to say "Computer, please print out the contents of this directory with dates but not all the other stuff."  I don't want all the <DIR>s, time, size, and other details.

It would be great if I could command it to find contents created before a date (or between dates) and print it out but I'll take the former if I can get it.

The end result is to take the directory list to a spreadsheet and make it searchable and sortable and be able to sort or search documents by date.

Help?

thanks

Merry





Sidewinder:
I suspect you want the contents of a folder not the properties of a single file. Also you are referencing the a: drive which is a floppy. Is this correct?

You can try this:

--- Code: ---forfiles /p c:\Directory /s /c "cmd /c echo @file,@fdate"

--- End code ---

I changed to drive letter to the system drive, but can be any valid drive on your system. If you redirect the output, it will be in csv format suitable for loading into Excel.

Good luck.  8)

Navigation

[0] Message Index

Go to full version