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

Kevin Korb kmk at sanitarium.net
Thu Aug 8 03:34:59 UTC 2019


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.		Kevin at FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			https://sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/rsync/attachments/20190807/266487d4/signature.sig>


More information about the rsync mailing list