User Tools

Site Tools


win:cleanup_files

Clean up log files

del enhanced

A good tool to clean up log files and other files which on a daily basis is the the freely available delen (del enhanced) utility:
http://delenxrd.adoxa.cjb.net/

The delen command works with wilcards to find files and understands timestamp based arguments as well.

Example batch file

This batch file is executed once a day by a scheduled task.

rem 28.02.2008 | Nik Wolfgramm
rem
rem cleans up all IIS logs older then five days and awstats data older then two months
rem should be run once a day by a scheduled task
rem
rem uses the freely available delen (del enhanced) utility:
rem http://delenxrd.adoxa.cjb.net/
rem
rem you can add a "/N" switch at the end of the command for testing
rem like this it only shows what "would" be deleted

rem delete all files ending with .log in D:\logfiles and it's subdirectories
C:\delenw D:\logfiles\*.log /[d,-5] /S

rem delete all files anding with .txt in D:\stats\data and it's subdirectories
C:\delenw D:\stats\data\*.txt /[d,-60] /S
/srv/wiki.niwos.com/data/pages/win/cleanup_files.txt · Last modified: 2009/08/15 12:14 (external edit)