rsync command

H.S. hs.samix at gmail.com
Sat Jan 24 03:28:53 UTC 2009


Robert Holtzman wrote:
> I shamelessly cribbed the following command off of a previous post:
> 
> rsync -vaHz --exclude '/proc' --exclude '/sys' --exclude '/media' /. 
> /media/disk
> 
> What I'm hazy on is the significance of "/." prior to "/media/disk". 
> There is a murky reference in the man page to merge in reference to "." 
> but I'm not sure it applies here.
> 
> I know I'll be embarrassed to find out how simple/obvious the answer is 
> but it just isn't coming thru to me.
> 

The syntax of the command is:
$> rsync <options> <src> <dest>

Your questions relates to <src> and <dest>.

<src> is the source directory or file you want to sync to the remote
destination. But this is a special argument. If the source path is ended
with a "/" (a trailing slash), then the contents of that path are synced
to the destination. So the command:
$> rsync <options> /path/to/folder/ /remote/path

will sync *contents* of "folder" to contents of "path" directory.

But the command:
$> rsync <options> /path/to/folder /remote/path
will sync "folder" directory to "/remote/path" directory thus creating a
"folder" directory in "path" at the destination.

Hence the trailing slash in the source is important. At the same time,
it is not important in the destination path.

Now, in your example, "/." actually should just mean "/", the period
doesn't really do anything.

Please see man page of rsync and pay special attention to first five or
six paras in the USAGE section.

If you have doubts with your usage of rsync, you can alwasy include -nv
options to see what will happen (v) while not really doing anything (n);
basically a verbose dry run.

Regards.

-- 

Please reply to this list only. I read this list on its corresponding
newsgroup on gmane.org. Replies sent to my email address are just
filtered to a folder in my mailbox and get periodically deleted without
ever having been read.





More information about the ubuntu-users mailing list