I have written this script because I am maintaining a little set of Perl libraries and tools at work, and I'm modifying the installed files on my PC. To avoid erasing it with old versions from CVS, I have the CVS repository elsewhere, and this little script is giving me which file is different from the repository in my current installation

I know the code is not error proof, but it does the work, and it's all I need

use strict; use File::Path; use File::Find; my $repodir='D:\Documents\Works\Perl\Perl tools\repository\amaPerl'; my $instdir='D:\AmaPerl'; my %options; $options{'wanted'}=\&compare_files; $options{'no_chdir'}=1; find(\%options, ($repodir)); exit(0); sub compare_files { return if($_ eq '.' || $_ eq '..' || $File::Find::dir =~ /CVS/); if(-f $File::Find::name) { my $file=substr($File::Find::name,length($repodir)+1); my $other_file=$instdir."\\".$file; if(! -f $other_file) { print "$file not found installed...\n"; } else { system("diff -q \"$File::Find::name\" \"$other_file\" > NU +L"); if($?) { print "$file is different\n"; } } } }

In reply to [Win] Compare files between two directories (and subdir) by jeepj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.