?
Solved

Delete files older then a certain date from a folder

Posted on 2004-09-29
4
Medium Priority
?
335 Views
Last Modified: 2008-01-09
I would like to automatically delete files from a certain folder that are older then a week old(for example) by using a batch file.
My OS is windows XP but I would also like to use it in windows 2000.

Is this possible and if so how
0
Comment
Question by:dbdp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 57

Expert Comment

by:Pete Long
ID: 12177947
Tip Top - Asked this very question and I was answered (excellently) here
http://www.experts-exchange.com/Operating_Systems/MSDOS/Q_20956707.html
0
 
LVL 23

Accepted Solution

by:
Danny Child earned 2000 total points
ID: 12181304
for a less scripty solution, try the FORFILES.EXE server resource kit tool
http://www.jsiinc.com/SUBL/tip5600/rh5645.htm

example:
FORFILES -pc:\foldername -s -m*.* -d-7 -c"CMD /C del @FILE"

-p = path
-s = include subdirs
-m = match filetype
-d = age in days (can also be set as an absolute date ie DDMMYYYY) note that - or + can be used here
-c = command to execute

there's also a -v Verbose switch
note, no spaces between the switches and their qualifiers above!
0
 
LVL 23

Expert Comment

by:Danny Child
ID: 12183599
you can get the file here
http://www.dynawell.com/reskit/microsoft/win2000/forfiles.zip

sheduled task to run the script should do it nicely!
0
 
LVL 23

Expert Comment

by:Danny Child
ID: 12225520
dbdp - hows it going with all this?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question