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.
rsync /path/without/slash host:/path/to/parent/with/slash/
rsync -r /path/to/directory/* host:/path/to/directory/
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.