RE: Check if files equal
- Posted by jordah ferguson <jorfergie03 at yahoo.com> Jul 08, 2002
- 420 views
Kats test is very efficient, but terribly slow. i think checking last characters of the file[50]bytes and beginning the ten random bytes in the middle. be sure to use seek() and where to get the correct file size. jordah Kat wrote: > On 7 Jul 2002, at 1:51, 10963508 at europeonline.com wrote: > > > > > What is the fastest way of checking if two very large files (~500 MB) > > are > > equal? > > I was thinking about this: > > -name > > -size > > -date last modified > > -pick about 10 random positions and check if bytes at those positions in > > both files match. > > I would not trust those tests at all. > > > Is there any better and faster way that I'm not aware of? > > Open file > while not eof do > Read them in, one buffer size at a time, > compare, > if not equal { tell me it's not equal, abort} > end while > > Kat > >