Rsync for Windows

From KlavoWiki
Jump to navigationJump to search

To allow you to copy data from Windows to a Linux computer using rsync.

  1. Download and install the application. The version that was available at the time I used was 3.1.0.
  2. Once the file has been downloaded and installed add the path C:\Program Files\cwRsync\bin to your environment variable. Also add the environmental variable HOME=Users\username
  3. run ssh-keygen -t rsa to generate a public key that you can copy to the Linux box that you want to use rsync with. The location of the created public key is %USERPROFILE%\.ssh\id_rsa.pub.
  4. Once the public key has been uploaded (or merged if it already exists) to the Linux file ~/.ssh/authorized_keys you will be able to copy files between the two servers without the need for authentication.

To start copying files with rsync on the Windows computer use the following command.
The following example is copying files from C:\Data\Files to the linux box /usr/src.

rsync -avrzh --progress /cygdrive/c/Data/Files username@myserver.com:/usr/src/

If your path has spaces wrap the path with commas. EG

rsync -avrzh --progress "/cygdrive/c/Data/Files" username@myserver.com:"/usr/src/"

If you are using batch files or automated processes don't use the --progress switch.