3 # compares the files and directory names in two different top-level directories
4 # and prints a report of the differences.
9 if [ -z "$dir1" -o -z "$dir2" ]; then
10 echo This script needs two directory names for which it will create a
11 echo list of differences in the two directory hierarchies.
14 if [ ! -d "$dir1/" -o ! -d "$dir2/" ]; then
15 echo The directories to be compared must already exist.
18 if [ "$dir1" == "$dir2" ]; then
19 echo "The two directories are the exact same folder name. So that's silly."
23 out1="$(mktemp "$TMP/compare_dirs_output.XXXXXX")"
24 out2="$(mktemp "$TMP/compare_dirs_output.XXXXXX")"
26 pushd "$dir1" &>/dev/null
28 sort "$out1" >"$out1".sort
31 pushd "$dir2" &>/dev/null
33 sort "$out2" >"$out2".sort
36 diff "$out1".sort "$out2".sort
38 rm "$out1" "$out1".sort "$out2" "$out2".sort