Created
August 1, 2010 17:59
-
-
Save goerz/503581 to your computer and use it in GitHub Desktop.
md5recursive.pl: Wrapper around md5sum, can work on files recursively.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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