benjwlee has asked for the wisdom of the Perl Monks concerning the following question:
<Updated> added open || die and my $ctx And here is the File::Find portion of my testrequire Encode; use Digest::MD5 qw(md5 md5_hex md5_base64); my $ctx = Digest::MD5->new;; my $where = "C:/0work/test"; open O, ">:utf8", "C:\\0work\\test\\out.txt" or die "Couldn't open STD +OUT: $!" || die "can't open\n"; opendir (D, $where) or print " \ncould not open the directory: $!"; binmode D, ":utf8"; binmode O, ":utf8"; print O "reading the list from the directory $where\n"; my @list = readdir (D); for my $file (sort @list){ next if ! -f $file; print O "$file\n"; open(I,"<$file") || die "couldbn't open $file"; binmode(I, ":utf8"); $ctx->addfile(I); my $digest = $ctx->b64digest; print "digest:", $digest; }
use strict; use warnings; use Cwd; use File::Find; use Digest::MD5 qw(md5 md5_hex md5_base64); use File::Basename; require Encode; $|++; my $ctx = Digest::MD5->new; my $totcnt=0; find (&d, "C:/0work/pics/Done"); binmode STDOUT, ":utf8"; sub d { my $file = $File::Find::name; print $file, "\n"; return unless -f $file; open(I,$file); binmode(I); $ctx->addfile(*I); my $digest = $ctx->b64digest; print $file, $digest, "\n"; close(I); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MD5 non ascii file name
by Joost (Canon) on Aug 19, 2008 at 20:19 UTC | |
by moritz (Cardinal) on Aug 19, 2008 at 20:29 UTC | |
by Joost (Canon) on Aug 20, 2008 at 00:17 UTC | |
|
Re: MD5 non ascii file name
by moritz (Cardinal) on Aug 19, 2008 at 20:23 UTC | |
by Corion (Patriarch) on Aug 19, 2008 at 20:39 UTC | |
by ikegami (Patriarch) on Aug 22, 2008 at 00:58 UTC | |
by Corion (Patriarch) on Aug 22, 2008 at 05:31 UTC | |
by ikegami (Patriarch) on Aug 22, 2008 at 06:52 UTC | |
by benjwlee (Initiate) on Aug 19, 2008 at 21:31 UTC | |
by moritz (Cardinal) on Aug 19, 2008 at 21:39 UTC | |
by benjwlee (Initiate) on Aug 19, 2008 at 21:45 UTC | |
by benjwlee (Initiate) on Aug 19, 2008 at 21:38 UTC | |
by ikegami (Patriarch) on Aug 22, 2008 at 00:46 UTC | |
|
Re: MD5 non ascii file name
by JavaFan (Canon) on Aug 19, 2008 at 20:29 UTC | |
by ikegami (Patriarch) on Aug 22, 2008 at 01:04 UTC |