#!/bin/rc if(! ~ $#* 2 || ! test -d $1 -a -d $2){ echo usage: dircmp dir1 dir2 exit usage } # NB: ignores empty directories rfork e ifs = ' ' a = `{cleanname $1} b = `{cleanname $2} {for(f in `{{@{cd $a; walk -f}; @{cd $b; walk -f}}|sort|uniq}){ cmp -s $a/$f $b/$f switch($status){ case *open if(test -f $a/$f) echo Only in $a: $f if not echo Only in $b: $f case *EOF *differ echo diff -u $a/$f $b/$f } }} | sort