rsync & rcp

Martin Pool mbp at
Fri Oct 31 09:06:12 EST 2003

On 30 Oct 2003, aslan at wrote:
> I was hoping that since you guys are the authors to rsync that
> you could answer a simple question for me.
> I'm trying to transfer files via the rsh/rexec protocol by
> remotely executing a cat command, i.e. "cat > foo.txt"
> and then sending data through the socket to the stdin of the remote
> process. This all works fine, except for the fact that I have to
> close the socket to force and end of file. 
> My question is, does rcp/rsync close a socket when it sends files
> to signify and end of file? If not, how does it send multiple files
> without closing the socket?

It uses a binary protocol to delimit files and describe metadata such
as their name and ownership.  As you say you cannot use the
end-of-file mark more than once.  It is conceptually similar to a tar

So if you wanted to send multiple files with just rsh, you could do

  tar c mydir | ssh somehost tar x

rsync at is a better forum for questions.

More information about the rsync mailing list