








If you found any of the tools on this page helpful, any donations would be
appreciated.
|
Dim strLogDir
strLogDir = "E:\LogFiles\W3SVC1"
Call Main()
Sub Main()
Dim objFSO
Dim objDir
Dim colFiles
Dim objFile
Dim objOutFile
Dim objRegExp
Dim bProcess
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strLogDir) Then
Set objDir = objFSO.GetFolder(strLogDir)
Set colFiles = objDir.Files
Set objRegExp = New RegExp
objRegExp.Pattern = "^ex\d\d\d\d\d\d.log"
objRegExp.IgnoreCase = True
For Each objFile in colFiles
If objRegExp.Test (objFile.Name) Then
bProcess = False
If objFSO.FileExists (objFSO.BuildPath(objFile.ParentFolder, "Purged_" & objFile.Name) ) Then
Set objOutFile = objFSO.GetFile( objFSO.BuildPath(objFile.ParentFolder, "Purged_" & objFile.Name) )
If DateDiff("s", objFile.DateLastModified, objOutFile.DateLastModified ) < 0 Then
bProcess = true
End if
Else
bProcess = True
End if
If bProcess Then
Call RemoveURLScan(objFSO.BuildPath(objFile.ParentFolder, objFile.Name), objFSO.BuildPath(objFile.ParentFolder, "Purged_" & objFile.Name))
End if
End If
Next
Set objOutFile = Nothing
Set objFile = Nothing
Set objRegExp = Nothing
Set colFiles = Nothing
Set objDir = Nothing
End If
Set objFSO = Nothing
End Sub
Sub RemoveURLScan(strInFile, strOutFile)
Dim objFSO
Dim objTS
Dim objTSOut
Dim strLine
Dim objRegExp
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTS = objFSO.OpenTextFile(strInFile , 1, False)
Set objTSOut = objFSO.CreateTextFile(strOutFile, True)
Set objRegExp = New RegExp
objRegExp.Pattern = "Rejected-By-UrlScan"
objRegExp.IgnoreCase = True
Do While Not objTS.atEndOfStream
strLine = objTS.ReadLine
If Not objRegExp.Test(strLine) Then
objTSOut.WriteLine strLine
End if
Loop
objTS.Close
objTSOut.Close
Set objRegExp = Nothing
Set objTS = Nothing
Set objTSOut = Nothing
Set objFSO = Nothing
End Sub
|