--delete-missing-args doesn't delete

MI mi.lists at alma.ch
Mon Apr 29 09:42:26 UTC 2019


Merci Francis.

Yes, that would probably be a way to do it, but I guess it needs 
correctly escaping the special characters which may appear in file 
names. (Yes, there are people who use "*" in file names, etc.)

So what I'm doing now is using neither --delete-missing-arg nor 
--files-from, but instead making hard links to the wanted files in a 
temporary directory on the source, then rsync-ing that temp dir, and 
then deleting the hard links in the temp dir.

It's a bit convoluted, but seems to work.

Thanks,

MI

-------- Original Message -------- (Francis.Montagnac at inria.fr, 
2019-04-25 13:26)

> Hi.
> On Tue, 23 Apr 2019 16:35:15 +0200 MI via rsync wrote:
>
>> If someone has a good suggestion on how to rsync a list of files and
>> delete from the destination any file that is not listed in --files-from,
>> that would be welcome.
> Assuming you are talking about files in a same source directory, you
> can do:
>
>     - generate a file (KEEP_FILE) with the list of files you want
>     - call: rsync ... --include-from KEEP_FILE \
>       	     --delete --delete-excluded \
>       	     SOURCE_DIR/ DESTINATION_DIR
>
> KEEP_FILE should have the format:
>
> + /keep1/***
> + /keep2/***
> ...
> - *
>
> leading / to match only at the first level
>
> /*** to match any level of sub-directory (if keep1 ... are
> directories)
>



More information about the rsync mailing list