Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

excelsior.ink

macrumors regular
Original poster
Apr 15, 2020
134
78
I am trying to use rsync to copy important files from my home folder to an external drive. I am using:

rsync -av --stats --delete --include "com~apple~CloudDocs" --exclude "Library" ${HOME} /Volumes/LaCie/ --dry-run

of course, --dry-run is just for simulation. So, I am trying to backup everything in the home folder except ~/Library but include ~/Library/Mobile\ Documents/com~apple~CloudDocs
However the --include doesn't work, everything under ~/Library is excluded.
Anyone has any idea how to fix this?
 
I am trying to use rsync to copy important files from my home folder to an external drive. I am using:

rsync -av --stats --delete --include "com~apple~CloudDocs" --exclude "Library" ${HOME} /Volumes/LaCie/ --dry-run

of course, --dry-run is just for simulation. So, I am trying to backup everything in the home folder except ~/Library but include ~/Library/Mobile\ Documents/com~apple~CloudDocs
However the --include doesn't work, everything under ~/Library is excluded.
Anyone has any idea how to fix this?
Have you tried using the full path to com~apple~CloudDocs in your command, the same path you mention in your explanation?
 
That's the problem, I cannot make it work:

rsync -av --stats --delete --include "~/Library/Mobile Documents/com~apple~CloudDocs" --exclude "Library" ${HOME} /Volumes/LaCie/ --dry-run

doesn't work. I tried using also Mobile\ Documents with \ as an escape char for the space.
 
Try reordering your --include and --exclude options just to see what happens.

Also try adding another -v option. This should output what's being skipped. A third -v will further increase verbosity, but it might be too much.

I briefly looked for an option to dump the filter rules, but didn't see one. That might be useful.

Maybe try restating the filters using the full filter rule syntax.
 
Love/hate rsync. So useful, yet so much a pain to get things to work.

Might try to break up the rsync as two separate invokes: one for everything but Library, second call to just do the iCloud Drive folder.

Or use find and pipe that to rsync.

Can try messing with the --filter possibilities. For example, can dynamically generate a filter file excluding everything under Library except iCloud Drive via the find command and pass that file to rsync.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.