find dir1 dir2 -type f -print0 | xargs -0 md5sum >md5sums #### chkmd5 md5sums #### #!/usr/bin/perl -ln use strict; use warnings; use Digest::MD5; use Cwd; use File::Basename; BEGIN { our $base=cwd } if ($. == 1) { chdir $_ or warn "Can't chdir to `$_': $!" for dirname $ARGV; } s/(\w{32})\s+// or die "input data may not be in the correct format"; my $orig=$1; warn("[$ARGV] `$_' doesn't exist!\n"), next unless -e; open my $fh, '<:raw', $_ or warn("Can't open `$_': $!\n"), next; my $new=Digest::MD5->new->addfile($fh)->hexdigest; warn "[$ARGV] md5sum mismatch for `$_'\n" unless $orig eq $new; close ARGV and chdir our $base if eof; __END__