Re: --delete-missing-args doesn't delete
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.montag...@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) -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: --delete-missing-args doesn't delete
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) -- Francis -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: --delete-missing-args doesn't delete
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 -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Re: --delete-missing-args doesn't delete
--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. ke...@futurequest.net (work) Orlando, Floridak...@sanitarium.net (personal) Web page: https://sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., signature.asc Description: OpenPGP digital signature -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html