projects
/
feisty_meow.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d47e6cd
)
took off training wheels by hiding debug output and added more comments.
author
Chris Koeritz
<fred@gruntose.com>
Wed, 7 Sep 2016 02:48:14 +0000
(22:48 -0400)
committer
Chris Koeritz
<fred@gruntose.com>
Wed, 7 Sep 2016 02:48:14 +0000
(22:48 -0400)
scripts/files/compare_dirs.sh
patch
|
blob
|
history
diff --git
a/scripts/files/compare_dirs.sh
b/scripts/files/compare_dirs.sh
index cb538205eed70edc33038525ea5fd26a02c0e3de..6c700d8f20a31e508b383295a416eb0d1ef812be 100644
(file)
--- a/
scripts/files/compare_dirs.sh
+++ b/
scripts/files/compare_dirs.sh
@@
-24,28
+24,23
@@
out1="$(mktemp "$TMP/compare_dirs_output.XXXXXX")"
out2="$(mktemp "$TMP/compare_dirs_output.XXXXXX")"
out2="$(mktemp "$TMP/compare_dirs_output.XXXXXX")"
+#hmmm: need error checking in here!!!!
-#hmmm: need error checking here!!!!
-
-
-
-
-
+# host processing on first dir.
if [[ $dir1 == *":"* ]]; then
if [[ $dir1 == *":"* ]]; then
- # host processing on first dir.
host1=${dir1%:*}
dir1=${dir1#*:}
host1=${dir1%:*}
dir1=${dir1#*:}
-echo "got host1 as $host1"
-echo "got new dir1 as $dir1"
+#echo "got host1 as $host1 and new dir1 as $dir1"
fi
fi
+
+# host processing on second dir.
if [[ $dir2 == *":"* ]]; then
if [[ $dir2 == *":"* ]]; then
- # host processing on second dir.
host2=${dir2%:*}
dir2=${dir2#*:}
host2=${dir2%:*}
dir2=${dir2#*:}
-echo "got host2 as $host2"
-echo "got new dir2 as $dir2"
+#echo "got host2 as $host2 and new dir2 as $dir2"
fi
fi
+
if [ -z "$host1" ]; then
# fully local compare location for first dir.
pushd "$dir1" &>/dev/null
if [ -z "$host1" ]; then
# fully local compare location for first dir.
pushd "$dir1" &>/dev/null
@@
-55,7
+50,8
@@
else
# remote compare location for first dir.
ssh "$host1" "cd \"$dir1\" && find ." >"$out1"
fi
# remote compare location for first dir.
ssh "$host1" "cd \"$dir1\" && find ." >"$out1"
fi
-# sort the output from that find.
+
+# sort the output from listing the first directory.
sort "$out1" >"$out1".sort
if [ -z "$host2" ]; then
sort "$out1" >"$out1".sort
if [ -z "$host2" ]; then
@@
-67,9
+63,13
@@
else
# remote compare location for second dir.
ssh "$host2" "cd \"$dir2\" && find ." >"$out2"
fi
# remote compare location for second dir.
ssh "$host2" "cd \"$dir2\" && find ." >"$out2"
fi
+
+# sort the output from listing the second directory.
sort "$out2" >"$out2".sort
sort "$out2" >"$out2".sort
+# compare the two sorted output files to show the missing files on each side.
diff "$out1".sort "$out2".sort
diff "$out1".sort "$out2".sort
+# clean up our output files.
rm "$out1" "$out1".sort "$out2" "$out2".sort
rm "$out1" "$out1".sort "$out2" "$out2".sort