Batch script to delete log files older than 30 days

Here is a simple script to delete the IIS Log files older than 30 days

Copy the following script into a batch file

@echo off

forfiles /P "C:\inetpub\logs\" /S /M *.logs /D -30 /C "cmd /C del @path"

@echo on

Replace the -30 to -90 and the script will delete logs older than 90 days.

You can either run it manually or create a task to run automatically.