sum has to read the entire file anyway, so there’s no gain from checksumming them to decide whether you want to compare them.

The right method to do this would be to put all the files in one set to start out with, read them byte-for-byte, and whenever files disagree, split the set into one set for each byte value encountered. Whenever a set consists of just one file, you can drop it. When you get to the end of any of the files and still have sets with more than one file in them, each of the sets is a group of identical files.

Of course, this is unworkable when you have more files than available handles. But in that case, all solutions I can think of (I wrote up and deleted three so far) are ugly as sin. Checksumming will usually get you out of the bind, but in edge cases with a huge number of identical files, that approach is really painful. Hmm.

Makeshifts last the longest.


In reply to Re^2: Identical Files to Symbolic Links by Aristotle
in thread Identical Files to Symbolic Links by PetaMem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.