Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Assistance with file compare

by Karger78 (Beadle)
on Oct 28, 2009 at 19:56 UTC ( [id://803779]=note: print w/replies, xml ) Need Help??


in reply to Re: Assistance with file compare
in thread Assistance with file compare

Well, here is the issue, the files do not have the same name. other then the name the files should be the exact same.

Replies are listed 'Best First'.
Re^3: Assistance with file compare
by bichonfrise74 (Vicar) on Oct 28, 2009 at 20:04 UTC
    So, if the names are not the same. How would you then know that file_1 is equal to file_2?

    If you do a md5sum on all the files and create something like a hash (eg. file_1: md5sum output), then compare the md5sum. If the md5sum are the same, then the files are the same? But what the chances that two files have the same md5sum but in reality they are not the same.
      MD5 hashes are typically 32 hexadecimal digits, so theoretically the chances of a collision are one in 3216, i.e. 1,208,925,819,614,629,174,706,176.

        You made two errors.

        32 hexadecimal digits is 1632 numbers. MD5 hashes are 128 bits in size. 16 hex digits are used to represent the hash since 1632 is equal to 2128.

        The chances of a collision cannot be ascertained since you haven't shown that every hash is equally likely to be generated.

      some of the files would be the same. The names may change, the files size etc would stay the same. So the only varible chaing would be the name.

        Well, there's your answer right there: just compare the file sizes. Then only compare (or md5) files whose sizes match. As long as your files aren't all the same length, that could be the fastest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://803779]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 11:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found