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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete old files using dos commands

Status
Not open for further replies.

rozzay

Programmer
Jan 3, 2002
142
US
morning,

I am trying to delete old files by date or older then by using dos commands. I have looked on the internet and books but have not find anything any codes or commands that tells you how to delete files by date instead of filename or filetype. Please help.

thanks in advance!
 
eheh. I love this tool. ROBOCOPY!

If you need help finding it let me know and i'l post a link to the file.

MCSE 2K - MCSA 2K - NET+ - A+

Paul..
 
You can't delete by date using dos commands. You can list files by date like this:

dir /o:d /n /s > files.txt

This will list all your files by date in a text file called files. The /s means it will list all subfolders also. However, then you have to edit files.txt, and cut and paste the delete command before each file name. Not pretty.

You can also use PKZip to do it: Download PKZ204G.EXE from any web site that has it, and execute the file to expand the utility.

Or, if you're not limited to using DOS commands, you can just use the Windows Search command to search for all files in the directory structure that are older than a specified date, then delete them from the results window.
 
You can use Robocopy to copy files based upon their date to a target folder, then do a standard del command to empty that folder.

I'm Certifiable, not certified.
It just means my answers are from experience, not a book.
 
you can do the same sort of thing from the Windows Search GUI tool... but I guess you wanted to do a batch job?

Look into HSM, Hierarchical Storage Management...

JTB
Have Certs, Will Travel
"A knight without armour in a [cyber] land."

 
Hello rozzay,

For batch operation, can consider using forfiles.exe coming with the resource kits. (Otherwise can download free from ms site.) An example can be looked at thread(96-819971) I'd involved in.

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top