'========================================================================================== ' ' DESC: Compares two files and outputs the differences in a new file ' ' USAGE: Create your two files (MEDIA.TXT, STANDARD.TXT) in the same ' dir as the script and run it ' ' AUTHOR: Todd Woolums (twoolums@toddwoolums.com) ' DATE : 05/29/2004 ' VERSION: 1.0 '========================================================================================== Const ForAppending = 8 Const ForWriting = 2 Const ForReading=1 Set objFSO = CreateObject("Scripting.FileSystemObject") strPath = objFso.GetParentFolderName(WScript.ScriptFullName) Set objFile1 = objFSO.OpenTextFile(strPath & "\Media.txt", ForReading) sContents1=objFile1.ReadAll sContents1 = replace(sContents1, " ", "") sContents1 = UCase(sContents1) objFile1.Close Set objFile2 = objFSO.OpenTextFile(strPath & "\Standard.txt", ForReading) sContents2=objFile2.ReadAll sContents2 = replace(sContents2, " ", "") sContents2 = UCase(sContents2) objFile2.Close If objFSO.FileExists(strPath & "\Results.txt") Then Set objFile3 = objFSO.OpenTextFile(strPath & "\Results.txt", ForWriting) Else Set objFile3 = objFSO.CreateTextFile(strPath & "\Results.txt") End If objFile3.WriteLine ("------------------ File 1 Differences -----------------") Set objFile1 = objFSO.OpenTextFile(strPath & "\Media.txt", ForReading) Do Until objFile1.AtEndOfStream strLine = objFile1.ReadLine strLine = replace(strLine, " ", "") strLine = UCase(strLine) If InStr(sContents2, strLine) = 0 then objFile3.WriteLine (strLine) End If strLine = "" Loop objFile1.Close objFile3.WriteLine ("------------------ File 2 Differences -----------------") Set objFile2 = objFSO.OpenTextFile(strPath & "\Standard.txt", ForReading) Do Until objFile2.AtEndOfStream strLine = objFile2.ReadLine strLine = replace(strLine, " ", "") strLine = UCase(strLine) If InStr(sContents1, strLine) = 0 then objFile3.WriteLine (strLine) End If strComputer = "" Loop objFile2.Close objFile3.Close sFileName = strPath & "\Results.txt" MsgBox "Finished processing. Results saved to " & strPath & "\Results.txt"