I'm working to rsync between my home file server and my parents home file server so we can act as off site backups for each other. However we don't want to backup everything, so I'm hoping to use a combination of a filter file and an include file.
To start, I wanted to get a single directory rsync'd, our nextcloud data folder, so I created a filter file,
+ nextcloud/ + nextcloud/data/ + nextcloud/data/*/ + nextcloud/data/*/files/ + nextcloud/data/*/files/** - nextcloud/data/*/files_versions/ - nextcloud/data/*/files_versions/** - *
Then I can run the following command,
rsync -hvrzPtR --partial --append-verify --update --delete-delay --delete-excluded --bwlimit=500 --info ALL --filter="merge /home/<user>/.rsync/parents_filter.txt" --prune-empty-dirs -e "ssh" <user>@<remoteserver>.com:/srv/./nextcloud/ /storage/backup/Parents/
this gets me,
/storage/backup/Parents/nextcloud
with all the directories and files under it that I want rsync'd over. perfect!
I like the idea of using relative paths to make the backup location a little cleaner.
But ultimately I have more locations that I want to rsync over, so I'd like to change the "root" of the source to just "/", and then use the filter file and the include file to add another location. This way I can get it all done with a single command, partly as I want to eventually add --link-dest to get a hardlinked incremental backup system implemented, and I think that will be easier with just a single rsync command vs a different one for each source location.
At first I didn't add any new locations, I just wanted to make sure I could mimic my first method and get the same result, and then build from there.
I changed my source location to,
"ssh" <user>@<remoteserver>.com:/
and added an include file with,
/srv/./nextcloud/
and updated my filter file,
+ srv/ + srv/nextcloud/ + srv/nextcloud/*/ + srv/nextcloud/data/ + srv/nextcloud/data/*/ + srv/nextcloud/data/*/files/ + srv/nextcloud/data/*/files/** - srv/nextcloud/data/*/files_versions/ - srv/nextcloud/data/*/files_versions/** - *
Which works exactly as I want EXCEPT the relative path feature appears to not work this way as I get,
/storage/backup/Parents/srv/nextcloud
I also tried with no difference in result,
"ssh" <user>@<remoteserver>.com:/./
Is what I'm hoping to do possible, or should I just give up on the Relative path with this method?
Thanks!