Without a delete option, "per-directory rules" are only relevant on the sending side, so you can feel free to exclude the merge files themselves without affecting the transfer. For example:
rsync -av --filter='dir-merge /.rsync-filter' --exclude=.excl host:src/dir /dest
rsync -av --filter='dir-merge /.rsync-filter' host:src/dir /dest
--filter='dir-merge /.rsync-filter' This tells rsync to look for per-directory .rsync-filter files that have
been sprinkled through the hierarchy and use their rules to filter the files in the transfer. If -F is repeated, it is a shorthand for this rule:
However, if you want to do a delete on the receiving side AND you want some files to be excluded from being deleted, you need to be sure that the receiving side knows what files to exclude. The easiest way is to include the "per-directory merge files" in the transfer and use --delete-after, because this ensures that the receiving side gets all the same exclude rules as the sending side before it tries to delete anything:
rsync -avF --delete-after host:src/dir /dest
However, if the files are not a part of the transfer, you need to either specify some global exclude rules (i.e. specified on the command line), or you need to maintain your own per-directory files on the receiving side. An example of the first is this (assume that the remote .rules files exclude themselves):
rsync -av --filter='remote .rules' --filter='remote /my/extra.rules'
--delete host:src/dir /dest
In the above example the extra.rules file can affect both sides of the transfer, but (on the sending side) the rules are subservient to the rules merged from the .rules files because they were specified after the per-directory merge rule.
In one final example, the remote side is excluding the .rsync-filter files from the transfer, but we want to use our own .rsync-filter files to control what gets deleted on the receiving side. To do this we must specifically exclude the per-directory merge files (so that they don(cqt get deleted) and then put rules into the local files to control what else should not get deleted. Like one of these commands:
rsync -av --filter=':e /.rsync-filter' --delete \
rsync -avFF --delete host:src/dir /dest