|
-
Nov 29th, 1999, 05:34 PM
#1
Thread Starter
Addicted Member
I want to run a file compare for 2 separate directories and see what differences there are between the files that are compared.
How can I achieve this in VB ?
-
Nov 29th, 1999, 05:49 PM
#2
Hyperactive Member
Use Beyond Compare.. it's the best compare tool I've seen around.
If you want to do it yourself in VB, figure out how you want to disaplay the differences.
The idea is easy.. files that are not exacly the same size can never be the same.. then the ones that do have the same size, open them and ready byte for byte and compare them, as soon as they're not equeal, you have 2 different files...
to display what the differences are depends I think on how you want to display it to a user. I'd recommend to download beyond compare (since windiff sucks hard) and see how they show it (then you also know why it's the best tool around).
-
Nov 29th, 1999, 06:07 PM
#3
Thread Starter
Addicted Member
Thanks for your reply Crazy D.
Where can I download Beyond Compare from ?
-
Nov 29th, 1999, 06:24 PM
#4
Hyperactive Member
-
Nov 29th, 1999, 08:44 PM
#5
Thread Starter
Addicted Member
Beyond Compare is great Crazy D. But just out of interest what function would I use to run a simple file compare in VB. Can you give me a quick example.
thanks.
-
Nov 29th, 1999, 09:20 PM
#6
Hyperactive Member
hi
something to start with...
Code:
Dim lFilePos As Long
Dim b1 As Byte, b2 As Byte
Dim bDifferent As Boolean
bDifferent = False
lFilePos = 1
Open "File1.ext" For Binary Access Read As #1 Len = Len(b1)
Open "File2.ext" For Binary Access Read As #2 Len = Len(b1)
Do Until EOF(1) Or EOF(2)
Get #1, , b1
Get #2, , b2
lFilePos = lFilePos + 1
If b1 <> b2 Then
bDifferent = True
Exit Do
End If
Loop
Close #1
Close #2
If bDifferent Then
MsgBox "NOt the same"
Else
MsgBox "the same"
End If
it works, just tested it.. quick though so watch out for errors....
hth
-
Nov 29th, 1999, 09:46 PM
#7
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|