Using --files-from but also having rsync delete...
wayned at samba.org
Sun Feb 27 23:16:35 GMT 2005
On Sun, Feb 27, 2005 at 05:34:48PM -0500, Eli wrote:
> It would build the file list and copy over some files, but not
> everything. Even with --delete-excluded it still didn't delete files
> on the dest server that weren't on the src system.
Then you must have done something wrong, such as still specifying
--files-from instead of using --include-from. The --delete option only
affects directories that rsync has recursively sent the contents of, and
using --files-from usually defines a list of files to send, not dirs.
> I can't generate a list of files to delete because they don't exist,
> I'd have to compare against the list of files I want to copy over and
> delete anything not in that list which is basically what I'm trying to
> have rsync do for me.
Since you said before that you'd be satisfied with rsync deleting
everything not in the --files-from list, all you need to do is to
save the prior files-from list and use it like this:
find ... >new_list
rsync ... --files-from=new_list ... remote:...
cat old_list new_list new_list | sort -u | ssh remote xargs rm
mv new_list old_list
(Specifying "new_list" twice is not a typo -- it makes any new items
duplicated so that the "sort -u" won't output them.)
More information about the rsync