Add an exclude parameter for a directory that should not be affected with
For example I want to transfer/update a complete root system but don't want to
delete running process info in /var on the remote system. Then I would do
something like rsync .... --delete-after --delete-exclude=/var ...
I assume you don't want to do this:
... which would both prevent any copying from /var and prevent any deleting in
var. If so, do this:
--filter='protect /var' OR -f 'P /var'
That tells the receiving side that all files in the /var hierarchy should be
protected from being deleted (assuming that you're transferring from /). You
might want to change that to be more specific, though, such as protecting
/var/run and /var/lock, but that's up to you.
Note that the --filter option was added in 2.6.4, so if you're pulling, the
receiving side needs to be at least 2.6.4, and if you're pushing, both sides
need to be at least 2.6.4.