LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rsync is not including the dirs that I wanted (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-is-not-including-the-dirs-that-i-wanted-4175506998/)

xeon123 06-04-2014 04:46 AM

rsync is not including the dirs that I wanted
 
I have this script to rsync my directories.

Code:

#!/bin/bash
# set -xv
FILTER="
+  Documents
+  Programs
+  Projects
+  bash-files
+  bookmarks
+  repositories
+  scripts
+  scripts
+  servers
+  workspace
-  *
"

echo "$FILTER" | rsync -avr --dry-run --include-from=- --progress -s $HOME/ "$1"

The problem is that it is rsync'ing files that I did not include in the list. e.g., .cache dir. What is wrong with my script? Am I missing setting any excludes?

jlinkels 06-04-2014 06:26 AM

Rsync syncs evertyhing by default. If you want to skip directories you have to exclude them. The include directive is to specify directories which are not excluded. This wording is from the man page.

So it seems that if you want to include only specified directories, you have to exclude everything. In your include statement you would specify what not to exclude.

jlinkels


All times are GMT -5. The time now is 06:09 PM.