Madams has asked for the wisdom of the Perl Monks concerning the following question:
(assume a "my ($md5)=new Digest::MD5" earlier and $file is the name returned by "File::Find::name"..)in_some_sub{ open(THISFILE,'< $file') or warn "ERROR: Can't open $outfile!\n"; binmode(THISFILE); while(read(THISFILE,$part,1)){ $md5->add($part); } $data = $md5->hexdigest; return unless ($data); remove_dupes($data,$file); }
BTW this works (correctly) if i use "$data=`md5sum -b $file`;" instead...:Fingerprinting files with MD5SUM... Press enter to continue... ERROR: Can't open md5sums.txt! d41d8cd98f00b204e9800998ecf8427e ./Thumbs.db ERROR: Can't open md5sums.txt! ---Duplicates found--- Remove which file: 1."./Thumbs.db" , 2."./ABNC001.JPG" ,or 3. Ignore and do not delete either file. (1/2/3)?:3 Ignoring... d41d8cd98f00b204e9800998ecf8427e ./ABNC001.JPG ERROR: Can't open md5sums.txt! ---Duplicates found--- Remove which file: 1."./Thumbs.db" , 2."./vincent05.jpg" ,or 3. Ignore and do not delete either file. (1/2/3)?:3 Ignoring... d41d8cd98f00b204e9800998ecf8427e ./vincent05.jpg ERROR: Can't open md5sums.txt! ---Duplicates found--- Remove which file: 1."./Thumbs.db" , 2."./tux_trek.gif" ,or 3. Ignore and do not delete either file. (1/2/3)?:
note the code as is reports a bogus digest for Thumbs.db..C:\WINDOWS\Profiles\madams\My Documents\My Pictures>md5sum -b Thumbs.d +b ABNC001.JPG vincent05.jpg tux_trek.gif 0b32237bb069cff23325ef2ea6c386ca *Thumbs.db 06b0c8cc903f49d131b27621389fb57d *ABNC001.JPG 032c0f9c5b5e9afe63936417037d8f4a *vincent05.jpg 8294e114b207d343000f74c72840a1ed *tux_trek.gif
(__) (\/) /-------\/ / | 666 || * ||----||
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why the same hex digest?
by Albannach (Monsignor) on Mar 16, 2001 at 06:37 UTC | |
by Madams (Pilgrim) on Mar 16, 2001 at 06:49 UTC | |
|
Re: Why the same hex digest?
by grinder (Bishop) on Mar 16, 2001 at 15:20 UTC |