I’m looking all over the place, but can’t figure out what I’m doing wrong since I want to use multiple includes with rsync.
I want it to work in “whitelist mode” for my Windows backup, where I specify a list of folders or PATTERNs, for example, but exclude literally everything else.
Here is the rsync command I am using in my script:
# Set initial rsync options
set -- -avAHX --delete --mkpath --progress
rsync "$@"
--include="*/"
--include="Documents and Settings"
--include="ProgramData"
--include="Program Files"
--include="Program Files (x86)"
--include="Users"
--exclude="*"
--log-file="$logfile"
"$srcdir" "$dstdir"
Ignore the variable names at the moment unless it’s important. Just know that $srcdir
has a slash at the end of it, if that matters.
When I use this, it still makes a bunch of empty folders from the Windows OS to the destination dir, but when I add --prune-empty-dirs
at the beginning before --include="*/"
it will ONLY copy over what is in “Documents and Settings”, but ignore all of my other --include
statements.
What am I doing wrong?