Cleanup log files

I stumbled across a handy Windows script file (WaRmZip) that is an all purpose utility for cleaning, compressing and/or moving outdated log files. For example, you may want to delete certain files older than X days. You can download this utility at WinAdmin’s web site:

One use of this utility is to delete older IIS log files. Go to C:\Windows\System32\LogFiles directory on your server, and take a look at the contents of each of the subfolders (W3SVC1, etc).  You may be surprised to find hundreds of files in each of these subfolders. Using the WaRmZip utility, I can create a one line batch file to handle removing these log files, and then schedule this batch file to run weekly or monthly.

Here’s the one line batch command: “C:\WaRmZip17\WaRmZip.wsf” “C:\Windows\System32\LogFiles” /da:7 /r /q

In this example, the da:7 option says to delete files older than 7 days, the /r option says to process all sub folders, and the /q option says to run it quietly (non verbose). There are options to zip/compress these files instead, if that is your preference, or to move them to a different drive/folder.


One thought on “Cleanup log files

  1. I thought this script would be just what we needed to clean up some Documentum user logon files (these multiply like rabbits) but when I ran the script with these parameters in both a command prompt and in a batch file 0-“C:\WaRmZip.wsf” /r “D:\Documentum\dba\log” /da:5 /df/dr/r/t

    I received an error that there was an invalid procedure call or argument in line 470 char 8 Code 800A0005

    Am I doing something wrong or is there a work around?


Leave a Reply to Rob Waters - Cancel reply

Your email address will not be published. Required fields are marked *