in reply to Checking MD5 of files in directory with corresponding MD5 file type
use warnings; use strict; use File::Slurp; my @md5_file = read_file("md5"); my $md5_string = join( "", @md5_file ); my $dirname = "path/to/files/to/be/checked"; while(my $file = (<'$dirname'/*>)) { open( my $fh, '<', $file ); binmode($fh); my $md5 = Digest::MD5->new->addfile($fh)->hexdigest; if ( $md5_string =~ $md5) { print "$md5 matches!\n"; } else { print "$md5 doesnt match ;(\n"; } }
Even though it looks like this code works as is, I am not sure if does and I dont have the time to test it myself right now, but hopefully it will help you a little bit on your way :)
Happy New Year!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Checking MD5 of files in directory with corresponding MD5 file type
by james28909 (Deacon) on Dec 31, 2016 at 15:28 UTC | |
by Anonymous Monk on Dec 31, 2016 at 15:41 UTC | |
by james28909 (Deacon) on Dec 31, 2016 at 16:24 UTC | |
by Anonymous Monk on Dec 31, 2016 at 17:18 UTC |