I'm using rsync with --delete to upload files to a webserver. There are files I want to exclude because they're configuration files. I'm using the "dir-merge" filter so I can have .rsync-filter files scattered through my directories, to exclude config/special files.

This seems simple, but [I've been having problems](https://unix.stackexchange.com/questions/156828/rsync-is-deleting-excluded-file/156842)!

After much investigation, my problem seems to be that if I exclude a file locally with a .rsync-filter, the file will still be deleted from the remote, *unless* there is already a corresponding .rsync-filter already on the remote.

What this means in practise is that if I create a .rsync-filter (locally) to exclude a file, rsync will still delete that file from the remote. But it will also copy the .rsync-filter to the remote, so the next time I try it, it *will be* correctly excluded.

So my question is (kind of broad) am I correct in this, and where does the man page mention this? It all seems a bit counter-intuitive to me!

Oh, and also, how is the "e" merge|dir-merge modifier useful if this is the case? (the "e" modifier excludes the merge-file from the transfer). Surely the "e" modifier makes it more likely rsync will not do what you expect?