in reply to scalable duplicate file remover
sub file2sha1 {
my $file=$_[0];
return '' if -d $file; #have to find out if to prune when a directory is found that doesn't match the regex
open my $f,"<$file";
my $sha1 = Digest::SHA1->new;
$sha1->addfile(*$f);
return $sha1->hexdigest;
}
sub file2sha1 { my $file = $_[ 0 ]; return '' if -d $file; #have to find out if to prune when a direct +ory is found that doesn't match the regex open my $f, '<:raw', $file or do { warn "Cannot open '$file' $!"; return; }; my $sha1 = Digest::SHA1->new; $sha1->addfile( $f ); return $sha1->digest; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: scalable duplicate file remover
by spx2 (Deacon) on Mar 03, 2008 at 08:53 UTC | |
by jwkrahn (Abbot) on Mar 03, 2008 at 18:18 UTC |