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

Wayne Davison wayned at samba.org
Sun Feb 27 18:46:49 GMT 2005


On Sun, Feb 27, 2005 at 04:31:15AM -0500, Eli wrote:
> I thought I could use --include-from and then add --exclude='*' to see if
> rsync would backup what I needed and then delete anything not in my list
> from the rsync server side, however it did not, not to mention coming up
> quite short in the list of files it should have backed up

You probably neglected to add an --include='*/' to include all
directories on the way down to the files.  I.e.:

rsync -av --include='*/' --include-from=files_from_file --exclude='*' \
  --delete /src/ /dest/

That works as long as all the files in the "files_from_file" are
relative to the same "/src/" path.  It also forces rsync to recurse
through all the directories, which makes it run a little slower.

Another potential solution is to generate the list of deleted files on
the system as you generate the file-from list, and then use a command
like this to delete them:

    ssh -l remote_user remote_host xargs rm </local/delete_list

That assumes that you have remote-shell access.

..wayne..


More information about the rsync mailing list