rsync
rsync is a utility for efficiently transferring and synchronizing files between a computer and an external hard drive and across networked computers by comparing the modification times and sizes of files.[3] It is commonly found on Unix-like operating systems. Rsync is written in C as a single threaded application.[4] The rsync algorithm is a type of delta encoding, and is used for minimizing network usage. Zlib may be used for additional data compression,[3] and SSH or stunnel can be used for security. Rsync is the facility typically used for synchronizing software repositories on mirror sites used by package management systems.[5][6] It is also one of the fastest ways to delete a large number of files with a binary application, especially when compared to the Linux standard applications rm and find.[7]
Rsync is typically used for synchronizing files and directories between two different systems. For example, if the command rsync local-file user@remote-host:remote-file is run, rsync will use SSH to connect as user to remote-host.[8] Once connected, it will invoke the remote host's rsync and then the two programs will determine what parts of the local file need to be transferred so that the remote file matches the local one.
Rsync can also operate in a daemon mode (rsyncd), serving and receiving files in the native rsync protocol (using the "rsync://" syntax).
It is licensed under the GNU General Public License.
Install
Linux Install
- apt install rsync
Windows Install
- See cwRsync
for automation, remember to setup ssh keys
- ssh-keygen
Usage
- from bash
-
- rsync -varuhPiE -e "ssh -p 12345" /home/ root@mail.host.local:/home/test/ --no-owner --no-perms --no-group --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rwx,Fg=wxr,Fo=rx
- rsync -varuhPiE -e "ssh -p 12345" /origin-folder root@somewhere.local:/home/imports/ --no-owner --no-perms --no-group --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rwx,Fg=wxr,Fo=rx
- from command prompt
-
- rsync.exe -varuhPiE "/cygdrive/f/remote profiles/" /cygdrive/p/ --no-owner --no-perms --no-group --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rwx,Fg=wxr,Fo=rx
- rsync.exe -varuhPiE -e "ssh -p 12345" /cygdrive/f backup@1.2.3.4:/share/destination --no-owner --no-perms --no-group --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rwx,Fg=wxr,Fo=rx