]> gitweb.fluxo.info Git - hydra.git/commitdiff
Sync-media: avoid empty source folders when rsyncing
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 2 Oct 2016 20:52:20 +0000 (17:52 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 2 Oct 2016 20:52:20 +0000 (17:52 -0300)
share/hydractl/sync-media

index 31e5fcd81edcc294539f38e6727c75310f19714b..a4fb69a691d6d88b101dfe6535ffc3c906eaba24 100755 (executable)
@@ -239,7 +239,8 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
       #git annex drop --auto --numcopies=2
       )
     elif [ -d "$CACHE/$folder" ]; then
-      if [ ! -e "$CACHE/$folder/.sync-media/skip" ]; then
+      # Avoid empty source folders or those configured to be skipped
+      if [ ! -e "$CACHE/$folder/.sync-media/skip" ] && [ ! -z "`ls -1 $CACHE/$folder`" ]; then
         echo "Syncing $VOLUME/$MEDIA/$folder..."
         rsync -av --delete --exclude=.sync-media $CACHE/$folder/ $VOLUME/$MEDIA/$folder/
       fi
@@ -261,7 +262,8 @@ elif [ ! -z "$REMOTE" ]; then
       git annex sync
       )
     else
-      if [ ! -e "$CACHE/$folder/.sync-media/skip" ]; then
+      # Avoid empty source folders or those configured to be skipped
+      if [ ! -e "$CACHE/$folder/.sync-media/skip" ] && [ ! -z "`ls -1 $CACHE/$folder`" ]; then
         echo "Syncing $VOLUME/$MEDIA/$folder..."
         rsync -av --delete --exclude=.sync-media $CACHE/$folder/ $REMOTE.$DOMAIN:$CACHE/$folder/
       fi