You can take the boy out of unix, but…

So we’re looking for a way to automatically delete old log files from IIS6. The built-in logger has lots of neat options but apparently no “keep at most 7 days’ worth of logs” option.

Searching around a bit, it seems like the solution is to download or whip up a script that deletes anything older than N days and put this in the task scheduler.

Here is a very long vbscript that does the job.

Here’s how you accomplish the same thing in a cygwin shell:

find /cygdrive/c/WINDOWS/system32/LogFiles/W3SVC1 -mtime +7 |xargs rm -f

I guess you can take the boy out of unix, but you can’t take the unix out of the boy.