trunk
Rev | Line | |
---|
[5eea6d8] | 1 | #! /bin/sh |
---|
| 2 | |
---|
| 3 | if [ $# -lt 2 ]; then |
---|
| 4 | echo "Usage: $0 directory1 directory2" |
---|
| 5 | exit 1 |
---|
| 6 | fi |
---|
| 7 | if [ -d "$1" -a -d "$2" ]; then |
---|
| 8 | echo "$0: start comparing '$1' and '$2'" >&2 |
---|
| 9 | fi |
---|
| 10 | |
---|
| 11 | list=`mktemp --tmpdir cmpdir.list.XXXXXXXXXX` || exit 1 |
---|
| 12 | tmp=`mktemp --tmpdir cmpdir.tmp.XXXXXXXXXX` || exit 1 |
---|
| 13 | trap "rm -- '$list' '$tmp'" EXIT |
---|
| 14 | |
---|
| 15 | wc=$PWD |
---|
| 16 | cd "$1" |
---|
| 17 | find ./ -print0 >> "$tmp" |
---|
| 18 | cd $wc |
---|
| 19 | |
---|
| 20 | cd "$2" |
---|
| 21 | find ./ -print0 >> "$tmp" |
---|
| 22 | cd $wc |
---|
| 23 | |
---|
| 24 | sort -z "$tmp" | uniq -z > "$list" |
---|
| 25 | |
---|
| 26 | comppath () { |
---|
| 27 | [ ! -e "$1/$3" ] && [ ! -e "$2/$3" ] && |
---|
| 28 | (echo "$0: something wrong abount '$3'" >&2; return) |
---|
| 29 | [ -e "$1/$3" ] && [ ! -e "$2/$3" ] && |
---|
| 30 | (echo "Only in '$1': '$3'" >&2; return) |
---|
| 31 | [ ! -e "$1/$3" ] && [ -e "$2/$3" ] && |
---|
| 32 | (echo "Only in '$2': '$3'" >&2; return) |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | xargs -a "$list" -0 -n 1 -I entry cmp "$1/entry" "$2/entry" |
---|
Note: See
TracBrowser
for help on using the repository browser.