using the find and delete commands in a batch file
I used to know of a way to delete DOS files older than 30 days by ways
of using the find command along with the "|" and the delete commands.
Something like this:
find *.txt | del * > 30
I do not remember the exact syntax. If anyone can help, it would be
Re: using the find and delete commands in a batch file
Chris Gregory schrieb:[color=blue]
> I used to know of a way to delete DOS files older than 30 days by ways
> of using the find command along with the "|" and the delete commands.
> Something like this:
> find *.txt | del * > 30
> I do not remember the exact syntax. If anyone can help, it would be
> greatly appreciated.[/color]
Well, your above example would delete all and put the screen output of
the operation into a file named '30' :)
But 'find' ios the wrong command anyway. It searches for text content in
one or more files and lists the lines.
The program FileFind (FF) of the PC TOOLS suite for DOS finds files
depending on their name, contend creation date (before/after), size or
whatever. And allows deleting the files found as well as viewing them
But the commandline options do not offer these funktions AFAIK. Just
searching for fiels with a given name or/and with a given content.
The command DEL does not take any input, so it won't take the piped
output of ANY other program to delete files.
So a batchfile for your purpose is a bit more complex.
I don't have a batch file solution at hand.
I think, GREP could be configured to put out the filename part of an
XDIR output where the date is older than given.
And XDEL would take a list of filenames to delete.
If Microsoft would invest only 5 minutes to make Windows boot 1/1000
we would save 30 working hours worldwide every day.