Tuesday, June 14, 2011

Delete files from file system older then 30 days

In order to have the files in a location (PATH) being deleted when they are older then 30 days, copy the line below to a text file and save it as a batch file.

forfiles /p "PATH" /s /d -30 /c "cmd /c del @file : date >= 30 days >NUL"

Then schedule a task to run daily at midnight.