Perl: the Markov chain saw | |
PerlMonks |
Re^3: Sort directory by file sizeby graff (Chancellor) |
on May 19, 2016 at 02:04 UTC ( [id://1163395]=note: print w/replies, xml ) | Need Help?? |
(1) When you want to post a chunk of code (or data) at the Monastery, start by typing these two lines into the composition box:
<c> </c> Then paste your code (or data) into the space between those two tags; you won't need to muck with anything else in order to get the code (or data) to show up correctly when posted. (Don't forget to put your paragraphs of explanation outside the code tags.) 2. Since you want to use file size to determine when to do md5 checksums, I think it would make more sense to build of a hash of arrays keyed by byte count: for each distinct byte count, the hash key is the size and the hash value is an array holding files of that size. Then loop over the hash and do md5s for each set of two or more files with a given size. You don't really need to do any sorting - just keep track of the different sizes. Here's how I would do it (on a unix/linux system): (That just lists sets of files that have identical content; you can tweak it do to other things, as you see fit.)
In Section
Seekers of Perl Wisdom
|
|