kzyz has asked for the wisdom of the Perl Monks concerning the following question:
Please help.use strict; use warnings; use File::Find; use File::Compare; #use Data::Dumper; my $dir1 = '/home/khan/Desktop/dir2'; my $dir2 = '/home/khan/Desktop/dir1'; my %dir = (); my $file=''; find(\&wanted, $dir1,$dir2); sub wanted { my $f = $File::Find::name; next if $File::Find::name =~ /^\.{1,2}$/; $f =~ s/^($dir1|$dir2)//o; $dir{$1}{$f}++; # create a hash for each parent $dir{$f}++; # count all files in both parents } foreach my $parent ($dir1, $dir2) { foreach my $file ( sort keys %{$dir{$parent} } ) { print "Failed" if ($dir{$file} == 1); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: bitwise comparison of files from two directories
by educated_foo (Vicar) on Feb 14, 2012 at 15:26 UTC | |
by kzyz (Initiate) on Feb 14, 2012 at 15:39 UTC | |
by Anonymous Monk on Feb 14, 2012 at 18:28 UTC |