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

MS-DOS A way to delete old files?

Status
Not open for further replies.

wellster34

Programmer
Sep 4, 2001
113
CA
Hi there,

Is there a script out there that someone knows or knows how to do the following:

via a MS-DOS batch file that could run to delete old files that are, for example, 3 months old from the system date?

This is for maintenance purposes.

Any ideas would be greatly appreciated!

Thanks
Josh
 
Wellster

I dunno about "Deleting" but the XCOPY command can check the dates of a file and only copy if newer. I believe you can also set a date.

I took a brief look at the MOVE and DEL commands and they had no additional switches that would helpe here.

However, I'd suggest maybe copying the files to a directory instead of removing them. That delete key can be a pain in the wrong hands.


-----------------
Cogito Ergo Sum
-----------------
 
Do a search on the web for dos and delete by date.
I found a dos based command that allows you to delete items based on either last used or last modified.
You could use it within a batch file to carry out what you need to do.
If you can't find anything let me know I can email to you.
 
Thanks for your tips.

I created a MS-DOS script to do the work and it works great.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top