Need DOS batch file
Posted on 2004-04-14
I need a DOS script to delete all the files in a specified subdirectory that have not been changed today. The purpose is to delete processed web logs from a Windows 2000 server, and I thought rather than spend hours trying to figure out how to do this in a batch file I should just ask for help.
The batch file will have to live in the directory above the folder to be cleaned out, that way I can just pass it the name of that folder, rather than an absolute path which could obviously be dangerous. Passing the batch file nothing would ideally give the usage although this might be asking a bit much.
For example if the batch file was called clearDirectory
would for each file in subdirectory foo, delete the file if it was last modified before today. That way the batch file won't try to delete web logs that are currently in use (the batch file will actually be called by the hit reporting program).