On Thu, 25 Jul 2002 12:25:06 -0400, [EMAIL PROTECTED] (Bob
Showalter) wrote:

>Uh, you're running the digest on the file *names* and not
>the file *contents*. Obviously, the file *names* aren't the
>same!

Thanks Bob, I gloss over the details sometimes. :-)
This one works fine:
##################################################
#!/usr/bin/perl
use Digest::MD5 qw(md5_hex);

$path= '/home/zentara/X/';
$path1='/home/zentara/Y/';

opendir DIR, $path or die "can't ls $path: $!";
@X= grep { $_ ne "." and $_ ne ".." } readdir DIR;
close DIR;
opendir DIR, $path1 or die "can't ls $path: $!";
@Y= grep { $_ ne "." and $_ ne ".." } readdir DIR;
close DIR;

$/=undef;
foreach $file (@X){
   $file1= $path1.$file;
   open (FH,"<$file");
   $file_slurp= (<FH>);
   close FH;
   open (FH1,"$file1");
   $file1_slurp=(<FH1>);
   close FH1;

if ( md5_hex($file_slurp) ne md5_hex($file1_slurp)){
    print "$file is not identical\n"}
}


%Z = map { $_ => 1 } @Y;
@diff = grep { not $Z{$_} } @X;
print "$path1 is missing @diff\n";
############################################



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to