From eadab872a76bdccb7c10c89c1f8561f18a0ffc77 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Wed, 1 Jun 2022 20:03:26 -0400 Subject: [PATCH] Rewrite msync --- src/.local/bin/msync | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/.local/bin/msync b/src/.local/bin/msync index f28760d..7e5df34 100755 --- a/src/.local/bin/msync +++ b/src/.local/bin/msync @@ -2,6 +2,8 @@ # Sync files to the main device for categorisation and renaming. +set -e + while getopts ":pr" o; do case "${o}" in p) ACTION=PUSH ;; @@ -25,17 +27,20 @@ if [ $ACTION = RECV ] then # Move files to the quarantine zone for categorisation and renaming - rsync -avPzc gamma:~/storage/pictures/Infinity/ ~/quar && \ - ssh gamma "rm -I storage/pictures/Infinity/*" + rsync -avPzc gamma:~/storage/pictures/Infinity/ ~/quar - rsync -avPzc gamma:~/storage/movies/Infinity/ ~/quar && \ - ssh gamma "rm -I storage/movies/Infinity/*" + rsync -avPzc gamma:~/storage/movies/Infinity/ ~/quar - rsync -avPzc gamma:~/storage/dcim/Camera/ ~/quar && \ - ssh gamma "rm -I storage/dcim/Camera/*" + rsync -avPzc gamma:~/storage/dcim/OpenCamera/ ~/quar - rsync -avPzc "gamma:~/storage/shared/Recordings/Sound records/" ~/quar && \ - ssh gamma "rm -I storage/shared/Recordings/Sound\ records/*" + rsync -avPzc "gamma:~/storage/shared/Recordings/Sound records/" ~/quar + + rsync -avPzc gamma:~/dr ~/quar + + # Delete remote files + + echo 'rm -rf ~/storage/pictures/Infinity/* ~/storage/movies/Infinity/* ~/storage/dcim/OpenCamera/* "~/storage/shared/Recordings/Sound records/*"' | ssh gamma /bin/sh + ssh gamma 'echo > dr' fi # Kill ssh agent