Rsync: How tobackup local iCloud folder to Synology
This post describes how to backup a local folder from iCloud to a Synology NAS using rsync.
rsync is a console tool that copies files either to or from a remote host or locally on the current host (it does not support copying files between two remote hosts).
Prepare Synology
First, we need to enable the rsync service on the Synology.
Open Control Panel, File Service and rsync tab.

In the Control Panel, go to the Shared Folder and create a folder for saving our backup with appropriate permissions.
Backup our local folder
In general, the command for backup looks into the following way:
rsync -azP <source-folder-path> <synology-login-username>@<synology-ip-addr>:<dest-folder-path>
Let’s assume I want to back up the Books folder from my Mac’s local iCloud folder to the remote bkps folder on Synology.
The full command will look into the following way:
rsync -azP /Users/myMacUser/Library/Mobile\ Documents/com\~apple\~CloudDocs/Books [email protected]:/volume1/bkps
where
/Users/myMacUser/Library/Mobile\ Documents/com\~apple\~CloudDocs/Booksis a local folder in iCloudmySynologyUserSynology user.192.168.1.100Synology IP address in my local network/volume1/bkpsremote folder on Synology for saving backups
Options explanation
-a, --archivearchive mode; same as -rlptgoD (no -H)--progressshow progress during transfer-Psame as--partial--progress-z, --compresscompress file data during the transfer
If we need to copy/transfer only files to the remote folder without creating the Book folder on the Synology, add a trailing slash after the Books folder, like long-path/Books/.
More detailed explanations and examples from the rsync’s documentation:

More documenation can be found via
man rsync