Linux tip 3 - rsync gotchas

October 22, 2009 by

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.


Made by Adam for himself at addumb.com
:wq