difference in behaviour of --filter --delete: cmdline vs. file

Madhu enometh at meer.net
Wed Aug 7 17:04:40 UTC 2019


Hello,

I want to avoid transferring a file which is present both on the source
tree and on the target tree when calling rsync with -a --delete.

mkdir -pv src/ dst/
echo file1 > src/file
echo file2 > dst/file

rsync -navi --delete --exclude file src/ dst/

works as expected. The file is not transferred nor is it deleted at
the receiver.

rsync -navi --delete --filter '- file' src/ dst/

also works as expected. The file is not transferred nor is it deleted at
the receiver.

echo '- file' > src/.rsync-filter
rsync -navi --delete -F -F src/ dst/

file is now deleted at the receiver, which is unexpected.  I expect this
to be the same as the earlier two invocations.

Am I missing something - or is this a bug?

I think the manual could be clearer on the s and r modifiers with regard
to --delete.  For now neither of the following works to protect file
from being deleted at the receiver

echo '-s file' > src/.rsync-filter
rsync -navi --delete -c -F -F src/ dst/

echo '-r file' > src/.rsync-filter
rsync -navi --delete -c -F src/ dst/

---Madhu



More information about the rsync mailing list