From 531aa7a268aa9dd23f0fe601f1cbb361d75c3802 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 6 Sep 2016 22:14:54 -0400 Subject: [PATCH] added comments, removed old commented code. --- scripts/files/compare_dirs.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/files/compare_dirs.sh b/scripts/files/compare_dirs.sh index 4469b128..ee1d69ae 100644 --- a/scripts/files/compare_dirs.sh +++ b/scripts/files/compare_dirs.sh @@ -1,5 +1,7 @@ #!/bin/bash +# compares the files and directory names in two different top-level directories +# and prints a report of the differences. dir1="$1"; shift dir2="$1"; shift @@ -13,18 +15,20 @@ if [ ! -d "$dir1/" -o ! -d "$dir2/" ]; then echo The directories to be compared must already exist. exit 1 fi +if [ "$dir1" == "$dir2" ]; then + echo "The two directories are the exact same folder name. So that's silly." + exit 1 +fi out1="$(mktemp "$TMP/compare_dirs_output.XXXXXX")" out2="$(mktemp "$TMP/compare_dirs_output.XXXXXX")" pushd "$dir1" &>/dev/null -#find . -type d >"$out1" find . >"$out1" sort "$out1" >"$out1".sort popd &>/dev/null pushd "$dir2" &>/dev/null -#find . -type d >"$out2" find . >"$out2" sort "$out2" >"$out2".sort popd &>/dev/null -- 2.34.1