# S.Chudley (www.chudley.me) : Diff all files between two directory structures my %l_src = (); my %l_dst = (); &list_files($ARGV[0], \%l_src); &list_files($ARGV[1], \%l_dst); foreach my $l_file (sort keys %l_src) { print "$l_file: "; if (defined $l_dst{$l_file}) { my @l_results = `diff \"$ARGV[0]\\$l_file\" \"$ARGV[1]\\$l_file\"`; if ($? != 0) { print "\n\n"; foreach my $l_line (@l_results) { print " ".$l_line; } print "\n"; } else { print "No change.\n"; } } else { print "Not found in target directory.\n"; } } foreach my $l_file (sort keys %l_dst) { if (!defined $l_src{$l_file}) { print "$l_file: Not found in source directory.\n"; } } sub list_files { local ($a_dir, *a_list) = @_; chomp(my @l_files = `dir /B \"$a_dir\"`); foreach my $l_name (@l_files) { my $l_file = $a_dir."\\".$l_name; if (-f $l_file) { my $l_path = $ARGV[1]; $l_path =~ s/\\/\\\\/g; if ($l_file =~ /^$l_path/) { $l_file =~ s/^$l_path\\//; } else { $l_path = $ARGV[0]; $l_path =~ s/\\/\\\\/g; $l_file =~ s/^$l_path\\//; } $l_file =~ s/^\.\\//; $a_list{$l_file} = 1; } elsif (-d $l_file) { &list_files($l_file); } } }