body { margin: 20px; text-color: #000000; font-family: Verdana, _sans; font-size: 10pt; } .title { font-weight: bolder; font-size: 14pt; } .sub-heading { font-weight: lighter; font-style: italic; } code {color: #035; background-color: #fafaff;} .highlight .lineno { color: #ccc; display:inline-block; padding: 0 5px; border-right:1px solid #ccc; } .highlight pre code { display: block; white-space: pre; overflow-x: auto; word-wrap: normal; }
I’m a Systems/Software Engineer in the San Francisco Bay Area. I moved from Columbus, Ohio in 2007 after getting a B.S. in Physics from the Ohio State University. I'm married, and we have dogs.

Under my github account ( I open-sourced python-aliyun in 2014, I have an outdated python 2 project starter template at python-example, and I have a pretty handy “sshec2” command and some others in tools.

Linux tip 3 - rsync gotchas

October 22, 2009

description: rsync trailing slashes are tricky. Always use them for existing directories, always omit them to create new ones at the destination.

Use rsync a lot? Do you use it just infrequently enough to have to check the man page every time? Me too. I always have trouble with out it interprets trailing slashes on paths.

  • Copy entire directory to remote parent directory:
    rsync /path/without/slash host:/path/to/parent/with/slash/
  • Copy contents of one directory to another:
    rsync -r /path/to/directory/* host:/path/to/directory/
  • Copy a directory into a new directory on another host:
    rsync /path/without/slash host:/path/to/new/directory

One more thing, I almost always use -aP, but for some high-latency connections you’ll probably also want to pass -z for compressing the stream.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License. :wq