Skip to content

Instantly share code, notes, and snippets.

@ovntatar
Last active December 31, 2015 12:19
Show Gist options
  • Save ovntatar/7985527 to your computer and use it in GitHub Desktop.
Save ovntatar/7985527 to your computer and use it in GitHub Desktop.
Check MD5 sum recursive
#!perl
use strict;
use warnings;
use File::Find;
use Digest::MD5;
@ARGV=grep { -d or !warn "`$_': not a directory!\n" } @ARGV;
die "Usage: $0 <dir> [<dirs>]" unless @ARGV;
find { no_chdir => 1,
wanted => sub {
return unless -f;
open my $fh, '<:raw', $_ or warn "Can't open `$_': $!\n" and return;
print Digest::MD5->new->addfile($fh)->hexdigest, ' ', $_;
}
}, @ARGV;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment