in reply to Finding out whether two directories are the same

I tried File::DirCompare and got some interesting results. It'll tell you which files differ, and, if $x and $y are the same directory, it'll simply return a prompt.

#!/usr/bin/perl use strict; use warnings; use File::Basename; use File::DirCompare; my $dir1 = '/path/to/dir1'; my $dir2 = '/path/to/dir2'; File::DirCompare->compare($dir1, $dir2, sub { my ($a, $b) = @_; if (! $b) { printf "Only in %s: %s\n", dirname($a), basename($a); } elsif (! $a) { printf "Only in %s: %s\n", dirname($b), basename($b); } else { print "Files $a and $b differ\n"; } });