Command line script for purging IIS log files older than 30 days

forfiles /P C:\inetpub\logs\LogFiles /S /M *.log /D -30 /C “cmd /c del @path”

Add >pathtologfile.log to log the activity.