On Wed, Apr 25, 2001 at 12:06:07PM +0200, andreas haupt wrote:
> Hello all,
>
> a quick one possibly:
> can I use rsync to delete a single file remotely?
> Assume I have deleted a file locally and I want it removed remotely
> but without having to rsync the whole directory.
>
> rsync --delete file remote_machine:.
>
> does not work but gives me a 'link_stat' error because
> the file does not exist anymore locally.
>
> (I know how to use rsh remote_machine "rm file" . The question is:
> can rsync do this?)
>
> for those ever curious about the background: I'm syncing big sites once
> per week but might be forced occasionally to delete singular files
> before the big rsync takes place. Using rsync to do this would save me
> time.
You can't use rsync itself, but the remote target to rsh can be a quoted
shell command that runs before the rsync copy and then sends the target
name to stdout:
rsync .... source remote_machine:'`rm file;echo targetdir`'
- Dave Dykstra