Deleting a remote file when deleted locally...

Hardy Merrill hmerrill at
Tue Nov 11 23:56:52 EST 2003

mailinglists at [mailinglists at] wrote:
> Hello,
> I have several individual files in a directory that I want to keep
> syncronized.  Here's an example:
> Server #1 (host):
> /tmp/file1
> /tmp/file2
> Now of course I can run "rsync -a /tmp/file1 remoteuser at remotehost:/tmp"...
> But, when I delete /tmp/file1 from the host and try to run this it
> complains about /tmp/file1 being non-existant...
> Can I force (or using a more elegant method) make the remote server delete
> an individual file if it no longer exists on the host?...  Obviously I do
> not want to rsync the entire directory, I just want that single file to be
> transferred...

Did you notice the --delete option in the rsync manpage?  Does
that not do what you want here?
Hardy Merrill
Red Hat, Inc.

More information about the rsync mailing list