Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How can I delete files by date in a batch file?  (Read 3132 times)

0 Members and 1 Guest are viewing this topic.

ericmarshall2000

  • Guest
How can I delete files by date in a batch file?
« on: March 09, 2007, 07:55:09 PM »
I want to delete all files older than 72 hours in a specific folder on a windows 2003 server to prevent the log files from taking up too much space.

I used to write batch files like this, and I can't even parse it any more.  Where is a good place to learn batch files today?  Not that many people use them any more.

This is the command I remember, but can't parse:
FOR %%F IN (*.*) DO (
IF %%~zF LSS 1 DEL %%F
)

This deletes files less than 1 (byte or kb, not sure anymore) in size.  I would need to find something similar by dates.

Back in the days I was programming (I am working on getting there again after a 15 year hiatus), I could write elaborate batch programs.  I don't have the books any more, but need to find a way to clear the files from the log, or disable logging until after the problem has occured, and hopes it happens again.   I would prefer to leave the logging on.


I need to find a picture of an old geezer for an avatar.  that is the way I feel recently