rsync

rsync is a versatile file copying utility. It can:
* Copy locally

 rsync [OPTION...] SRC... [DEST]
 
 rsync test1.txt test2.txt

* Copy remotely to/from another host over
– any remote shell
– default to ssh

Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
Push: rsync [OPTION...] SRC... [USER@]HOST:DEST
 
# Copy local directory "DirToCopy" and all its contents to remotebox in /home/me directory
# using archive mode and compression mode
rsync -az ./DirToCopy me@remotebox:/home/me
 
# As as above.
# Notice the slash in ./DirToCopy/ meaning ONLY directory contents are copied.
rsync -az ./DirToCopy/ me@remotebox:/home/me/DirToCopy
 
# Delete extraneous files from the receiving side
# Exclude error directories
rsync -azq --delete --exclude=**/error/ ./DirToCopy me@remotebox:/home/me
 
# Pull and sync your web site every five minutes
*/5 * * * * /usr/bin/rsync -azq --delete --exclude=**/error --exclude=**/pictures -e ssh me@server1.example.com:/var/www/ /var/www/

– a remote rsync daemon

  Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
        rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
  Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
        rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST

* Sending only the differences between source files and destination files
– uses delta-transfer algorithm (can be turned off with -W or –whole-file option
– checks file sizes and last modified time

References
* http://www.samba.org/ftp/rsync/rsync.html

This entry was posted in unix. Bookmark the permalink.