New delete option?

Wayne Davison wayned at
Mon Feb 14 18:11:25 GMT 2005

On Mon, Feb 14, 2005 at 02:03:56PM +0100, ?yvin S?mme wrote:
> I would like an option that deletes the source file(s) *if*
> successfully transferred (i.e. delete source upon completion).
> Maybe an option like '--delete-source'.

There is a patch in the "patches" dir called delete-sent-files.diff that
probably does what you want.  It deletes any files that got successfully
transferred, but does not delete files that were already up-to-date, nor
does it delete things like directories, symlinks, or devices.

> Sounds dangerous?

It certainly could be.  An older version of the patch could have allowed
the option to be used on a read-only daemon server, for instance.  That
bug has been plugged two different ways in the current source:  both by
setting a global read-only flag that doesn't allow anything to change on
a read-only server, and by refusing --delete-sent-files if the server is
marked as read-only.  If you're not concerned about the daemon bug, you
can use the patch that came with 2.6.3 (in the "patches" dir of the tar
file) to patch 2.6.3.  If you want a version that is more secure, snag
the CVS source (you can use the latest "nightly" tar file from the web
site, if you like).

I've considered including the patch in the main rsync distribution
before, and am doing so again.  What do you think about how the patch
works?  Is the deleting of only the sent files the right idiom for what
you need?


More information about the rsync mailing list