#!/bin/csh if ($#argv < 2) then echo "$0 comparePath ext1 [ext2 ...] [.] [-]" echo " 1. Use . to compare all files." echo " 2. Use - to suppress listing of files in comparePath but not in" echo " the current directory." exit 0 endif set d = $argv[1] set listAll = 1 if (!(-d $d)) then echo "Error:" echo "$0 comparePath ext1 [ext2 ...]" echo "Argument $d is not a directory." exit 0 endif foreach ext ($argv[2-]) if ("$ext" == "-") then set listAll = 0 continue endif if ($ext == ".") then set fList = (*) else set fList = (*.$ext) endif foreach f ($fList) if (!(-e $d/$f)) then printf "%22s %s\n" $f " is not at destination" else if (!(-d $f)) then set ans = (`diff $f $d/$f | wc`) if ($ans[1]) then set ansA = (`diff $f $d/$f | fgrep "<" | wc`) set ansB = (`diff $f $d/$f | fgrep ">" | wc`) if ($ansA[1] > $ansB[1]) then printf "%22s %s %d lines\n" $f differs $ansA[1] else printf "%22s %s %d lines\n" $f differs $ansB[1] endif endif endif endif end end if ($listAll == 0) then exit 0 endif foreach ext ($argv[2-]) if ("$ext" == "-") then continue endif if ($ext == ".") then set fList = (`cd $d; echo *`) else set fList = (`cd $d; echo *.$ext`) endif foreach f ($fList) if (!(-e $f)) then printf "%22s %s\n" $f " is not at source" endif end end