-
Dos Batch File Help
Hi Guys,
I figured i would ask in here as im not having much luck.
Basically, i am writing a batch file script that for all intents and purposes is a clean up script (a little more complicated tho).
What i need is to have a command line that will produce a list of files older than a given date, and to only show the name of the file without lots of eroneous crap.
I cant seem to find anything or anyway of doing this.
If anyone has any suggestsion i would appreciate it.
It must be able to be run as a command line and produce a list of files within the criteria given.
Thanks in advance :Oops:
-
dir /b, Gives bare information ie file info
dir /od sorts by date, oldest first
So put it together, dir /b /od should give u the list ur after.
Finally ">output.txt" dumps the output to a file called output.txt in the directory that the command is called from.
so, dir /b /od >output.txt
Running from my profile directory on this machine i get the following
WINDOWS
Start Menu
.housecall
Favorites
Desktop
My Documents
output.txt
Hope that helps
Nimbu
-
Also edit, an easier way maybe with VB for Dos, as that will let u combine your batch file and a few lines of code to parse it specifically the way you want.
But its been too damn long since Ive done anything in VBdos..............................
-
might hunt for vbdos.
i know how to output it to file etc and order it, but its the fact i only wanna see files of a certain date...........or older than a certainamount of days - thats the hard bit
-
Found "DEL OLD v2.0":
http://www.filelibrary.com/Contents/DOS/50/6.html
This can be used with "test mode" and you can feed it a number of hours.
e.g.
"DEL_OLD *.txt 24:00 /t" will list all the .TXT files older than 24 hours
There are probably better things to do it - TreeView or something if you want a GUI, or hunt Google for command-line utils.