I\'m trying to backup a filesystem, exclude /mnt
but include a particular path within /mnt
, it looks like using --filter is recommended over --include
In case someone else is battling with this as I am, I have managed to get the following to work. In my case I'm selectively sync repositories from another server.
Place filters in a file:
+ epel/
+ epel/7/
+ epel/7/x86_64/
+ epel/7/x86_64/Packages**
+ epel/7/x86_64/repodata**
- **
And can then sync everything as intended with:
cd /srv/repo
rsync -rvzP -f 'merge /home/user/sync-filter.txt' ./ user@remote:/srv/repo/
Initially, I had my filter file set up with epel/7/x86_64/Packages/**
, which failed to work because of the trailing slash before the **
. Removing the /
made it all spring in to life as intended!