rsync - Remote copy and synchronization

rsync is a Ubuntu/Linux tool to copy, upload and backup files from a local computer to a remote server. Local and remote directory get synchronized by updating new or modified files only. Identical files, located already on the the server, are not copied again.

Examples

upload (copy) files from local directory Data/ to remote server directory Backups Data/

Only files that are not already on the server will be copied.

Note, that both location paths end with a forward slash (/)!

rsync -avz Data/ loginName@serverName:Backups/Data/

download (copy) all files from a remote server directory Repository/Data/Run1/ to local directory MyProjects/Data/

If connection interrupts, rsync command can be re-started to copy the missing files only).

rsync -avz loginName@serverName:Repository/Data/Run1/ MyProject/Data/

copy multiple directories Exp1 ..2 ..3 (including directory names) into the remote Backups/ Data/ folder

Note, that the local location paths missing the ending forward slash (/) which mean to "copy inside" the remote location.

rsync -avz Data/Exp1 Data/Exp2 Data/Exp3 loginName@serverName:Backups/Data/

delete old files from server: upload new files and remove all old server files that are deleted in the original local Data/ directory

Files of remote location Backups/Data/ folder will be synchronized (mirrored) with local Data/ folder

rsync -avz --del Data/ loginName@serverName:Backups/Data/

Options: rsync -avz

rsync -a is the archive mode to copy the complete content of a directory (all files and sub-directories), preserve time stamps, keep owner and group information and all file and directory permissions. Option -a is a short cut for using all the individual options -r -l -p -t -g -o -D

rsync -v to show progress information and messages (verbose)

rsync -z to compress files before internet transfer (in case of large files and limited network connection)


Read more

http://manpages.ubuntu.com/manpages/man1/rsync.1.html

https://en.wikipedia.org/wiki/Rsync