--delete-missing-args doesn't delete

MI mi.lists at alma.ch
Tue Apr 23 14:35:15 UTC 2019


Thank you Kevin.

It seems that I misunderstood the purpose of this --delete-missing-args 
option.

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.

Thanks,

MI


-------- Original Message -------- (Kevin Korb via rsync, 2019-04-23 14:11)

> --files-from will delete files from the destination that are listed but
> not existing in the source.  It isn't delete what isn't listed.
>
> On 4/23/19 5:29 AM, MI via rsync wrote:
>> I'm generating a list of files to sync, and would like all the files not
>> in my list to be deleted from the destination. I thought that
>> --delete-missing-args would do just that, but it doesn't delete anything.
>>
>> Would someone have an idea of what I'm doing wrong?
>>
>> This is what I tried :
>>
>> ~$ mkdir -p /tmp/source /tmp/dest
>>
>> ~$ for i in {1..3}; do echo "keep $i"      > /tmp/source/keep$i; done
>>
>> ~$ for i in {4..5}; do echo "to remove $i" > /tmp/source/to-delete-$i; done
>>
>> ~$ rsync -va /tmp/source/ /tmp/dest/
>> sending incremental file list
>> ./
>> keep1
>> keep2
>> keep3
>> to-delete-4
>> to-delete-5
>>
>> sent 410 bytes  received 114 bytes  1,048.00 bytes/sec
>> total size is 45  speedup is 0.09
>>
>> ~$ for i in {1..3}; do touch /tmp/source/keep$i; done
>>
>> ~$ cd /tmp/source/
>>
>> /tmp/source$ find . -name "keep*" | tee /tmp/source/file-list
>> ./keep2
>> ./keep1
>> ./keep3
>>
>> Now, using my file-list which does not include the "to-delete*" files, I
>> hoped that these would be deleted. The new files were correctly copied,
>> but nothing was deleted:
>>
>> /tmp/source$ rsync -vva --delete --delete-missing-args --force
>> --files-from=/tmp/source/file-list . /tmp/dest/
>> building file list ... done
>> delta-transmission disabled for local transfer or --whole-file
>> ./
>> keep1
>> keep2
>> keep3
>> total: matches=0  hash_hits=0  false_alarms=0 data=21
>>
>> sent 259 bytes  received 143 bytes  804.00 bytes/sec
>> total size is 21  speedup is 0.05
>>
>> /tmp/source$ ls -Al /tmp/dest/
>> total 20
>> -rw-rw-r-- 1 mi mi  7 Apr 22 23:43 keep1
>> -rw-rw-r-- 1 mi mi  7 Apr 22 23:43 keep2
>> -rw-rw-r-- 1 mi mi  7 Apr 22 23:43 keep3
>> -rw-rw-r-- 1 mi mi 12 Apr 22 23:42 to-delete-4
>> -rw-rw-r-- 1 mi mi 12 Apr 22 23:42 to-delete-5
>>
>>
>> The files not in my --files-from list are still at the destination.
>>
>> Thanks for any help,
>>
>> MI
>>
>>
>> PS: my version of rsync :
>>
>> ~$ rsync --version
>> rsync  version 3.1.1  protocol version 31
>> Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others.
>> Web site: http://rsync.samba.org/
>> Capabilities:
>>     64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
>>     socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
>>     append, ACLs, xattrs, iconv, symtimes, prealloc
>>
>>
>



More information about the rsync mailing list