Has anyone written something that can compare two text files and output the differences, or know of freewhere I can download to do this?
Printable View
Has anyone written something that can compare two text files and output the differences, or know of freewhere I can download to do this?
Here is some code to work with:
VB Code:
Function SameFile(ByVal Path1$, ByVal Path2$) As Boolean 'Nucleus Dim ba1() As Byte, ba2() As Byte Dim ff&, i&, u& On Error Resume Next If Len(Dir$(Path1)) And Len(Dir$(Path2)) Then ff = FreeFile Open Path1 For Binary As #ff ReDim ba1(0 To LOF(ff) - 1) Get #ff, , ba1 Close #ff ff = FreeFile Open Path2 For Binary As #ff ReDim ba2(0 To LOF(ff) - 1) Get #ff, , ba2 Close #ff u = UBound(ba1) If u = UBound(ba2) Then For i = 0 To UBound(ba1) If ba1(i) <> ba2(i) Then Exit For Next If i = u + 1 Then SameFile = True End If End If End Function
There is actually a DOS command that does this (at least there used to be). Can't remember the name of it though.
DOS file compare command (still works)
fc filname1 filename2
Thanks Nuke, found the dos command it is call ed comp