Can't remember where I found the script, but if you are a SysAdmin and looking to do a Log Rotation deleting the old ones, this would help you:
Option Explicit
Dim intDaysOld, strObjTopFolderPath, strLogFIleSuffix, ObjFS, ObjTopFolder
Dim ObjDomainFolder, ObjW3SvcFolder, ObjSubFolder, ObjLogFile, ObjFile
intDaysOld = 1
strObjTopFolderPath = "x:\TopFolder"
strLogFIleSuffix = ".log"
'Assumes folder structure is like the following:
' x:\TopFolder\
' whatever.com\
' w3svcX\
' ex020101.log
Set ObjFS = CreateObject("Scripting.FileSystemObject")
Set ObjTopFolder = ObjFS.GetFolder(strObjTopFolderPath)
For Each ObjDomainFolder in ObjTopFolder.SubFolders
For Each ObjW3SvcFolder in ObjDomainFolder.SubFolders
Set ObjSubFolder = ObjFS.GetFolder(ObjW3SvcFolder)
For each ObjLogFile in ObjSubFolder.files
Set ObjFile = ObjFS.GetFile(ObjLogFile)
If datediff("d",ObjFile.DateLastModified,Date()) > intDaysOld and lcase(right(ObjLogFile,4))=strLogFIleSuffix then
'*****************************************************
'DON'T UNCOMMENT THIS UNTIL YOU KNOW IT WORKS PROPERLY!!!
WScript.Echo("Will delete " & ObjSubFolder.name & "\" & ObjFile.name)
'ObjFile.Delete
'*****************************************************
End If
Set ObjFile = nothing
Next
Set ObjSubFolder = nothing
Next
Next
Set ObjTopFolder = nothing
Set ObjFS = nothing