rraghvani Any way I can update the below to show in the log the differences if found?
Function CompareFiles(fileName1, fileName2)
Dim fso, file1, file2, regEx
Dim fileText1, fileText2, newText1, newText2
Const ForReading = 1
' Creates the FileSystemObject object
Set fso = CreateObject("Scripting.FileSystemObject")
' Reads the first text file
Set file1 = fso.OpenTextFile(fileName1, ForReading)
fileText1 = file1.ReadAll
file1.Close
' Reads the second text file
Set file2 = fso.OpenTextFile(fileName2, ForReading)
fileText2 = file2.ReadAll
file2.Close
' Creates the regular expression object
Set regEx = New RegExp
' Specifies the pattern for the date/time mask
' MM/DD/YYYY HH:MM:SSLL (for example: 4/25/2006 10:51:35AM)
regEx.Pattern = "\d{1,2}.\d{1,2}.\d{2,4}\s\d{1,2}:\d{2}:\d{2}\w{2}"
regEx.IgnoreCase = True
regEx.Global = True
' Replaces the text matching the specified date/time format with <ignore>
newText1 = regEx.Replace(fileText1, "<ignore>")
newText2 = regEx.Replace(fileText2, "<ignore>")
' Compares the text
CompareFiles = (newText1 = newText2)
End Function
Sub Main
Dim fileName1, fileName2
fileName1 = "d:\text1.txt"
fileName2 = "d:\text2.txt"
If CompareFiles(fileName1, fileName2) Then
Log.Message("The files are equal")
Else
Log.Error("The files are different")
End If
End Sub