summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-10-02 17:52:20 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-10-02 17:52:20 -0300
commit6933ca88b0da38012239e63cd3f7ec12e7108e33 (patch)
tree4aa616078370b1954f5d2715ce63a699fe038721 /share
parent70d59e46199414f1ddafe495b1eadee8276fefde (diff)
downloadhydra-6933ca88b0da38012239e63cd3f7ec12e7108e33.tar.gz
hydra-6933ca88b0da38012239e63cd3f7ec12e7108e33.tar.bz2
Sync-media: avoid empty source folders when rsyncing
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydractl/sync-media6
1 files changed, 4 insertions, 2 deletions
diff --git a/share/hydractl/sync-media b/share/hydractl/sync-media
index 31e5fcd..a4fb69a 100755
--- a/share/hydractl/sync-media
+++ b/share/hydractl/sync-media
@@ -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