rsync

From Peyton Hall Documentation

Revision as of 20:07, 2 May 2007 by Huston (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Template:oldfaq

Need to synchronize files between two places quickly? Use rsync. Also good for copying files from one location to another.

rsync -avue ssh source_machine:/dir dest

This will synchronize all the files from "machine"'s "/dir" directory to the local directory "dest". Note that this is one way, so if you want to sync files in both directions, you have to repeat the command, swapping the order of source and destination. The '-e' option, and corresponding 'ssh', tells rsync to use ssh to do the transfer.

Please note that the presence or absence of a trailing slash on the directories *DOES* make a difference! For example:

rsync -avue ssh coma:/u/user/WWW .

..will create a directory in the current directory named WWW, and copy the contents of the remote dir to the source. It's like copying /u/user/WWW to the current directory. However,

rsync -avue ssh coma:/u/user/WWW/ .

..will copy the *contents* of /u/user/WWW to the current directory, and not the directory itself! This is important if you're trying to synchronize two filesystems that started as a copy of each other, but are now slightly different, as you want to make sure the source and destination are the same as they were in the original copy.

'man rsync' for more (lots more) details.

Also have a look at the rsync homepage: http://rsync.samba.org (especially if you're looking for a binary compiled version to run on a remote machine)

Lastly, there's a rsync tutorial at http://everythinglinux.org/rsync/ which is very informative.

Personal tools