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.


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

rsync -avz Data/ loginName@serverName:DataBackup/

copy multiple directories Exp1 ..2 ..3 (including directory names) into the backup folder

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

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

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

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)