Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare two text files

Status
Not open for further replies.

shiggyshag

Programmer
Dec 14, 2001
227
GB
Hi

I wish to comapare two text file just to see if they are different.

Ie
Same = true
Diff = false

Cheers
 

Code:
Dim fso, f1, f2, contents1, contents2

Set fso = CreateObject("Scripting.FileSystemObject")

Set f1 = fso.OpenTextFile("file1.txt", 1)
contents1 = f1.ReadAll
f1.Close

Set f2 = fso.OpenTextFile("file2.txt", 1)
contents2 = f2.ReadAll
f2.Close

If (contents1 = contents2) Then
    Same = true
    Diff = false
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top