prevent filter excluded files from being deleted

Kevin Korb kmk at sanitarium.net
Mon Mar 6 23:01:27 UTC 2023


I am not 100% sure I am interpreting this correctly but I think you are 
complaining that the file was being deleted in the first command?  If 
so, instead of -F try --include='*/' --exclude='*'.  Otherwise, maybe 
you want a second -F?

On 3/6/23 16:04, Heiko Schlittermann via rsync wrote:
> Hello,
> 
> given are 2 directories:
> 
>      a
>      ├── a-file
>      └── .rsync-filter
> 
>      b
>      └── a-file
> 
> I'd like to sync a/ -> b/, but I'd like to *exclude* all files. But I do
> not want to delete the excluded files. (The real scenario is a way more
> complex, the above is my reproducer.)
> 
> and the following rsync command: `rsync -F --del a/ b/`
> Note, there is *no* `--delete-excluded`:
> 
>      $ rsync -F --del -inav a/ b/
>      sending incremental file list
>      *deleting   a-file
>      .d..t...... ./
> 
>      sent 62 bytes  received 29 bytes  182.00 bytes/sec
>      total size is 0  speedup is 0.00 (DRY RUN)
> 
> Why? Because it is excluded? Using the `--exclude` option does what I
> expect:
> 
>      $ rsync --exclude 'a-file' --del -inav a/ b/
>      sending incremental file list
>      .d..t...... ./
>      >f+++++++++ .rsync-filter
> 
>      sent 92 bytes  received 22 bytes  228.00 bytes/sec
>      total size is 4  speedup is 0.04 (DRY RUN)
> 
> even does what I expect:
> 
>      $ rsync --filter '- *' --del -inav a/ b/
>      sending incremental file list
>      .d..t...... ./
> 
>      sent 58 bytes  received 19 bytes  154.00 bytes/sec
>      total size is 0  speedup is 0.00 (DRY RUN)
> 
> Version:
> rsync  version 3.2.3  protocol version 31
> 
>      Best regards from Dresden/Germany
>      Viele Grüße aus Dresden
>      Heiko Schlittermann
> --
>   SCHLITTERMANN.de ---------------------------- internet & unix support -
>   Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
>   gnupg encrypted messages are welcome --------------- key ID: F69376CE -
> 
> 

-- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
	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.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,



More information about the rsync mailing list