Greetings,
I have noticed using the DirCompare.pm module that during a comparison of two directories, the comparison only searches for matching files "files with the same file name but different content" at the same "level" of the directory tree, I have noticed this same functionality with most comparison programs no matter what language they are written in, I understand the purpose behind only searching for matching files with matching names at the same level of the directory tree because files with matching names can exist in different folders but my question is how could one go about modifying DirCompare.pm to search all levels of the two directories being compared for matching files and unique files.
Here is the code i am using along with DirCompare.pm
Thanks for your time amd help.
use File::DirCompare;
use File::Basename;
$x='directory1';
$y='directory2';
File::DirCompare->compare("$x","$y", 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";
}
});
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.