Return to Snippet

Revision: 4715
at January 17, 2008 17:06 by fwiffo


Initial Code
#!/usr/bin/perl -w

$CMP="/usr/bin/cmp";

$dir0=$ARGV[0];
$dir1=$ARGV[1];

if(!$dir0 || !dir1){ print "Error: need both directory paths to compare";exit;}

@files0=`find $dir0 -type f`;
$count=0;
foreach $file0 (@files0){
        $file1=$file0;
        $file1=~s/$dir0//;
        $file1=$dir1.$file1;
        chomp($file0);
        chomp($file1);
        $file0=~s/\$/\\\$/;
        $file1=~s/\$/\\\$/;
        system("$CMP $file0 $file1");
        if($count>10){
                print ".";
                $count=0;
        }else{
                $count++;
        }
}

Initial URL


Initial Description


Initial Title
binary compare two directories

Initial Tags


Initial Language
Perl