Place this script in a target directory. Run the script, passing as a parameter the name of a source directory. This script will list all files which are in one directory but not the other and all files which are in both directories but have changed. Example: perl diffcompare.pl "/export/home/markj/cgi-bin"
# sierrathedog04, jonathansamuel@yahoo.com, August 2001 # place this script in the target directory and # pass it the name of the source directory from the # command line. # This utility requires that the diff command works on the user's syst +em. use strict; my $sourceDir = shift || die "Please pass the name of a source directo +ry enclosed in quotes. \n"; chomp $sourceDir; $sourceDir =~ s/\/\$/\$/; unless (-d $sourceDir) { die "$sourceDir is not a valid source directory. Please pass the n +ame of a valid source directory enclosed in quotes. \n"; } opendir THISDIR, "."; my @allFiles = readdir THISDIR; closedir THISDIR; foreach (@allFiles) { if (-e "$sourceDir/$_") { print "$_ in target differs from that in source directory $sou +rceDir\n" if `diff $_ $sourceDir/$_`; } else { print "$_ found in target but not in source directory $sourceD +ir\n"; } } print "\nFinished checking target\n"; opendir SOURCEDIR, $sourceDir; my @allSourceFiles = readdir SOURCEDIR; foreach (@allSourceFiles) { unless (-e "./$_") { print "$_ found in source directory $sourceDir but not in targ +et\n"; } }

In reply to Compare Directories and List Changed or Missing Files by sierrathedog04

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.