--delete & --files-from can't be used as a purge list. Alternate strategy suggestions?

Wayne Davison wayned at samba.org
Fri Jan 14 19:55:59 GMT 2005


On Fri, Jan 14, 2005 at 04:02:39PM +0000, Simon wrote:
> Looking around it would appear --delete works upon directory updates,
> but there is nothing in the documentation that indicates that options
> in the example above cannot be used in this way.

I've updated the docs for the next release to make this clearer.

> Can anybody suggest alternative strategies to achieve a similar effect?

If you're tyring to run this rsync command to remove remote files:

    rsync -av --files-from=files-to-delete / somehost:/dest/dir

this pipeline will actually do that job:

    sed 's:^/::' files-to-delete | ssh somehost 'cd /dest/dir; xargs rm'

That lets you use a list of relative filenames that are read-in from a
file on the local system and delete them on the remote system.  The sed
command may not be needed in your setup, but I include it because rsync
strips leading slashes from the files it reads via --files-from.  You
may also wish to add the "-r" optionto "rm" if you want to remove dirs.

..wayne..


More information about the rsync mailing list