It is a little confusing but in order to have an exclude dir merge
filter do both things (prevent transfer and prevent deletion) then it
needs to be on both ends of the transfer.  The file on each end only has
partial effect on what rsync does.

Think of it like a file you (as a regular user) can make in your home
dir telling the backup system to not backup a file.  If that file has
already been backed up rsync will also remove it from the backup on the
next run.

On 8/7/19 1:04 PM, Madhu via rsync wrote:
> 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
> 

-- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
        Kevin Korb                      Phone:    (407) 252-6853
        Systems Administrator           Internet:
        FutureQuest, Inc.               ke...@futurequest.net  (work)
        Orlando, Florida                k...@sanitarium.net (personal)
        Web page:                       https://sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to