Using --files-from but also having rsync delete...

Eli eli-list at experthost.com
Mon Feb 28 01:33:01 GMT 2005


Wayne wrote: 
> 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.

Ahh, ok then that makes sense.  No I didn't do anything wrong - however
since my text file contains only the directories and files that I *want*
copied, it never contains the folders I don't want (even when I was testing
with using --include-from and was using + & - to specify include/excludes).
My commands were never giving rsync a local idea of what folders to remove,
only which ones to copy.  That explains why rsync was never deleting
anything (oh and that command that took forever finally finished, and also
didn't work).

So, no fault of my own or rsync, just something it can't do.  I'm cool with
that.  Any chances of a feature being able to do this ever being added to
the wishlist?  Basically the feature would have rsync alert the rsync daemon
of all the files it was told about in --files-from (and/or --include[-from],
etc...) and have the rsync server delete all files in the destination
directory that weren't in that list.  Sponsoring this work could certainly
be an idea (but I'd have to run it by my boss first).

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

Neato - I will keep that idea in mind.  I just thought of the possibility of
using CVS to accomplish what I'd like.

Thanks again for your help,

Eli.




More information about the rsync mailing list