MS-DOS code to delete old Files

0 Votes

MS-DOS code to delete old Files

I am using windows XP and need to write a DOS batch (.bat) file that will delete old files from a directory. This will run on a schedule and will not require human interaction to input any data. My problem is, I am not good at writing batch files. I can do the basic 101 type stuff, but finding dates and doing date comparison is beyond me.

This batch file will need to check the current date and then compare this date with the file date. If a file is found to be greater than, say, 3 months old then delete that file, then go to the next file and repeat the process until the end of file is reached.

Is anyone out there good with writing DOS batch files and can give me some help on this? If you can also recommend a good free online site where I can go to understand the syntax of finding the file date and how to compare dates? I have found several tutorials but they do not touch on dates. Thanks.