IIS Log File Cleanup Script

Put this in a file.vbs and add it to your Task Scheduler.

sLogFolder = "c:\inetpub\logs\LogFiles"
iMaxAge = 7
Set objFSO = CreateObject("Scripting.FileSystemObject")
set colFolder = objFSO.GetFolder(sLogFolder)
For Each colSubFolder in colFolder.SubFolders
	Set objFolder = objFSO.GetFolder(colSubfolder.Path)
	Set colFiles = objFolder.Files
	For Each objFile in colFiles
		iFileAge = now-objFile.DateCreated
		if iFileAge > (iMaxAge+1) then
			objFSO.deletefile objFile, True
		end if
	Next
Next