Skip to content

Instantly share code, notes, and snippets.

@goerz
Created August 1, 2010 17:59
Show Gist options
  • Save goerz/503581 to your computer and use it in GitHub Desktop.
Save goerz/503581 to your computer and use it in GitHub Desktop.
md5recursive.pl: Wrapper around md5sum, can work on files recursively.
#!/usr/bin/perl -w
use strict;
my $recursive = 'true';
md5sum(\@ARGV);
sub md5sum{
my $filelist = shift;
foreach my $file (@{$filelist}){
if ( -f $file ){
system("md5sum \"$file\"");
}
if ( (-d $file) && ($recursive eq 'true') ){
my @recfilelist;
if ($file =~ /[ ]/){
@recfilelist = glob('"'."$file".'"/*');
} else {
@recfilelist = glob("$file/*");
}
md5sum(\@recfilelist);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment