the often called question: Can I run rsync on Windows by using the putty agent?
Answer: Yes, but there a some steps to setup such an environment.
I’m assuming you aleady have putty installed at your computer. In this example the putty tools like plink etc. are downloaded to D:\tools\putty.
First of all install cygwin’s rsync:
- Download install cygwin it from the Internet
- Choose a (root) Install directory, i.e. D:\tools\cygwin
- Choose the directory where the files should downloaded to
- From the packages list choose
Net / rsync (latest version, here 3.2.3)
Devel / gcc-core (latest stable version, here 10.2.0)
- Add an Icon to the startmenu to be able to start the cygwin terminal
when the installation finishs rsync could be found at
Then you need cygnative because there is an incompatibility of stdin/stdout redirection between cygwin and native Win32 programs. I will place it in the putty directory (curl is already included in newer Windows 10 releases)
Download cygnativ source
D:\> cd D:\tools\putty D:\tools\putty> curl https://raw.githubusercontent.com/davidecolombo/cygnative/master/cygnative.c -o cygnative.c
If you want to call cygwin commands (gcc, rsync) from a cmd shell you must add the cygwin bin folder and the putty folder to the path variable otherwise you have to specify the full path (in cygwin notation) to cygnative and plink for the rsync -e (–rsh) parameter.
D:\tools\putty> set PATH=%PATH%;D:\tools\cygwin\bin;D:\tools\putty;
D:\tools\putty> D:\tools\cygwin\bin\gcc.exe cygnative.c -o cygnative.exe D:\tools\putty> cygnative.exe cygnative - a programm to use stdin/stdout redirection on native win32 programms called from cygwin (C) Copyright 2009, Frank Behrens, Version 1.2 Usage: cygnative [args...]
Now you can call rsync. The local directory must be given in cygwin notation. For D:\Temp you have to use /cygdrive/d/Temp/. Use the cygwin terminal to determine the correct path.
D:\tools\putty> rsync -args -e="cygnative plink" /cygdrive/d/Temp/ firstname.lastname@example.org:/tmp