rsync: Be mindful of the trailing slash!

Pop Quiz:  What’s the difference between these two commands?

#1: rsync -a --delete /some/path/a/ /some/otherpath/
#2: rsync -a --delete /some/path/a /some/otherpath/

Answer: the first will make /some/otherpath mirror the contents of /some/path/a, while the latter will create a directory in /some/otherpath/a whose contents will mirror /some/path/a.

Be warned! If you’re not careful and you use #1 when you intend to use #2, you can lose files in /some/otherpath.

Edit: Found this resource online: Rsync explanations and recommendations

Advertisements

October 21, 2008. Tags: . Linux.

Leave a Comment

Be the first to comment!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback URI

%d bloggers like this: