Rsync is an open source utility that provides fast incremental file transfer. Rsync can synchronize directory structure between two machines connected over the network. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. It is widely used in backup scenarios and as an improved copy statement.
To sync files and or folders across
rsync -ave ssh user@hostname:/home/user/source /home/user/destination
# Options -a Archive mode: It behaves like the recursive mode but keeps all file permissions, symbolic links, file ownership, etc. -v Verbose output: Shows the details of the transfer. -e Instructs the rsync to use the SSH protocol for remote transfers.
By default, rsync will not remove files/folders from the destination folder if they were removed since the last rsync. To remove the files/folders that have been deleted at souce use