[GRLUG] Dumb rsync question

Adam Tauno Williams awilliam at whitemice.org
Wed Feb 27 16:57:35 EST 2013


On Wed, 2013-02-27 at 15:45 -0600, L. V. Lammert wrote:
> OK, .. I'm trying to rsync a single file from a directory to a remote 
> host, .. IME I thought rsync used the entire argument as the source, 

No, that would be horribly horribly broken.

> however it appears that rsync is separating the path from the 
> filename - i.e. the file gets transferred to the user root directory, 
> and the path gets stripped!
> rsync -av public_html/lee remote:

Nope, that will put "lee" in the default target for whatever the
security context on "remote" is.

> "lee" arrives in the user home directory, instead of in "public_html" 
> UNDER that user home directory. How does one preserve the target path 
> of "public_html"?

Simply, it doesn't.

What you probably want is the --relative option.

<quote source="man rsync">
Use relative paths. This means that the full path names specified on the
command line are  sent  to  the  server rather than just the last parts 
of the filenames. This is particularly useful when you want to send 
several different directories at the same time. For example, if 
you used this command:....
</quote>

--
Adam Tauno Williams  GPG D95ED383
Systems Administrator, Python Developer, LPI / NCLA



More information about the grlug mailing list