osx - Excluding Everything in /Library/ but /Library/Mail via rsync -


i have rsync script backs user's home folder using line of code:

/usr/bin/caffeinate -i /usr/bin/rsync -rlptdn --human-readable --progress --ignore-existing --update $path/$name/ --exclude=".*" --exclude="public" --exclude="library" /volumes/backup/users/$name\ -\ $date 

how ignore in ~/library/ ~/library/mail/? wanted include rsync flag, --include="/library/mail", i'm not sure if should depend on rsync exclusions & inclusions can become unreliable , varies between different versions of os x rsync.

maybe command-line regex tool more useful? example:

ls -d1 ~/library/*| grep -v '^mail' > $alist exec <${alist} read src . . . $rsync..etc... 

rsync's --include , --exclude options obey called "precedence" there's firm rule can rely means explicitly include before exclude sent.

in case, add --include ~/library/mail before first --exclude.


Comments