"Fossies" - the Fresh Open Source Software Archive 
Member "afio-2.5.2/regtest/dircompare" (30 Nov 2018, 705 Bytes) of package /linux/misc/afio-2.5.2.tgz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1
2 #the way of calling this script is strange to preserve compatibility
3 #with the horrid approximation of a bash that I found on a freebsd system.
4
5 #dircompare compares contents of dirs $d1 and $d2 carefully
6 #prints problems found to stdout
7 #exits with 1 on error.
8
9 fail=0;
10
11 #compare file contents
12 find $d1 -type f | $AWK '{ n=$0; gsub("^"d1,d2,n); print "if ! cmp \""$0"\" \""n"\"; then fail=1; fi"; }' d1=$d1 d2=$d2 - >dircompare.tmp
13
14 #compare file stat blocks
15 source ./dircompare.tmp
16
17 find $d1 | $AWK '{ n=$0; gsub("^"d1,d2,n); print "if ! ./cmpstat \""$0"\" \""n"\" "cmpflag"; then fail=1; fi"; }' d1=$d1 d2=$d2 cmpflag=$cmpflag - >dircompare.tmp
18
19 source ./dircompare.tmp
20
21 rm dircompare.tmp
22
23 exit $fail