From 7a84fbdfa8819afebba29e251d664d8790ba05af Mon Sep 17 00:00:00 2001 From: Marc Gallet Date: Wed, 15 Jun 2016 13:38:18 +0200 Subject: [PATCH] Fix for issue #128 --- duplicity-backup.conf.example | 3 +++ duplicity-backup.sh | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example index 6911eec..deb24b0 100644 --- a/duplicity-backup.conf.example +++ b/duplicity-backup.conf.example @@ -208,6 +208,9 @@ INCLIST=( "/home/foobar_user_name/Documents/" ) # "/**Icon?" \ # "/**.AppleDouble" \ # ) +# +# If you don't want to exclude anything, use EXCLIST=() +# # Simpler example with one location. Adapt it to your needs. EXCLIST=( "/home/foobar_user_name/Documents/foobar-to-exclude" ) diff --git a/duplicity-backup.sh b/duplicity-backup.sh index 5e122b2..b3d78c3 100755 --- a/duplicity-backup.sh +++ b/duplicity-backup.sh @@ -553,7 +553,7 @@ include_exclude() OLDIFS=$IFS IFS=$(echo -en "\t\n") - # Exlcude device files? + # Exclude device files? if [ ! -z "${EXDEVICEFILES}" ] && [ "${EXDEVICEFILES}" -ne 0 ]; then TMP=" --exclude-device-files" EXCLUDE=${EXCLUDE}${TMP} @@ -561,14 +561,18 @@ include_exclude() for include in "${INCLIST[@]}" do - TMP=" --include='$include'" - INCLUDE=${INCLUDE}${TMP} + if [[ -n "$include" ]]; then + TMP=" --include='$include'" + INCLUDE=${INCLUDE}${TMP} + fi done for exclude in "${EXCLIST[@]}" do - TMP=" --exclude '$exclude'" - EXCLUDE=${EXCLUDE}${TMP} + if [[ -n "$exclude" ]]; then + TMP=" --exclude '$exclude'" + EXCLUDE=${EXCLUDE}${TMP} + fi done # Include/Exclude globbing filelist