P
Pierre Thibault
Hello,
I am having problems with a perl script. The fellowing script is
working well except for directory or file names using accented
characters. The last line (!system...) is giving me errors when I'm
using the result from the 'find' command if the file or the directory
contain accented characters. The error is "No such file or directory".
I'm using Perl 5.0 version 8 subversion 1 RC3 on Mac OS 10.3.4.
I really don't know how to solve this problem. Any help would be
appreciated.
#!/usr/bin/perl
#
# Create a list of files with their MD5 sums
use strict;
`mkdir -p /Users/pierreth/M5`;
my @path_list = ((split /:/, $ENV{"PATH"}), "/Applications");
for(@path_list) {
my $file_name_for_path = $_;
$file_name_for_path =~ s#/#-#g;
$file_name_for_path =~ s#^-##;
my $save_path = "/Users/pierreth/M5/$file_name_for_path";
`rm $save_path -f > /dev/null 2>&1`;
print "Now processing $file_name_for_path\n";
for(`find -L $_ -type f`) {
chomp;
s#\\#\\\\#g; # Paying attention to special character like \
s#'#\\'#g; # or '
!system ("md5sum '".$_."' >> '".$save_path."'") or die "Error $_
$save_path";
}
}
I am having problems with a perl script. The fellowing script is
working well except for directory or file names using accented
characters. The last line (!system...) is giving me errors when I'm
using the result from the 'find' command if the file or the directory
contain accented characters. The error is "No such file or directory".
I'm using Perl 5.0 version 8 subversion 1 RC3 on Mac OS 10.3.4.
I really don't know how to solve this problem. Any help would be
appreciated.
#!/usr/bin/perl
#
# Create a list of files with their MD5 sums
use strict;
`mkdir -p /Users/pierreth/M5`;
my @path_list = ((split /:/, $ENV{"PATH"}), "/Applications");
for(@path_list) {
my $file_name_for_path = $_;
$file_name_for_path =~ s#/#-#g;
$file_name_for_path =~ s#^-##;
my $save_path = "/Users/pierreth/M5/$file_name_for_path";
`rm $save_path -f > /dev/null 2>&1`;
print "Now processing $file_name_for_path\n";
for(`find -L $_ -type f`) {
chomp;
s#\\#\\\\#g; # Paying attention to special character like \
s#'#\\'#g; # or '
!system ("md5sum '".$_."' >> '".$save_path."'") or die "Error $_
$save_path";
}
}