--delete-missing-args doesn't delete

Kevin Korb kmk at sanitarium.net
Tue Apr 23 12:11:32 UTC 2019


--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
> 
> 

-- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
	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/20190423/3ac41625/signature.sig>


More information about the rsync mailing list