Delete IIS Log Files Older Than 60 Days

Deletes IIS log files older than 60 days. Syntax: /d -60 = days old. /p = logs reside here.

Add to favorites
E-mail Twitter Digg Facebook
  • So simple and works great! With a minor change....
    1 Posts | Last post July 29, 2010
    • forfiles /p %~dp0W3SVC1 /s /m *.log /d -60 /c "%COMSPEC% /c del /q @file"
      Tested on Windows Server 2003 SP2.... IIS log files are under c:\windows\system32\logfiles\w3svc1, and we saved the CMD file under c:\windows\system32\logfiles\ (the %~dp0 variable)