If you're on Windows, and you'd like to be able to use rsync with your Strongspace account, read on. This article will show you how to install and configure rsync on your Windows machine, and how to set up SSH keys on Strongspace so that you don't need to type in your password every time you use rsync. It assumes you're running a decent version of Windows, namely Windows XP, Windows Server 2003 or Windows 2000. I've tested it with Windows XP SP2.
Thanks go to Phil Brennan for telling me about the particular build of rsync used here, both Phil and Des Traynor for proof reading, and Marten Veldthuis for helping to fix some technical errors.
You need to download a Windows version of rsync. The best one I've found, in that it works, is called cwRsync. You can download the installer from Sourceforge.

The installer is contained inside the zip file. You'll need to extract the installer before you can use it. Go to where you have downloaded the zip file, right-click on it and choose "Extract all...". A dialogue box will pop up; just click Next, Next and Finish.
Open up the new folder and double-click the installer. It's pretty standard stuff - if you've ever installed a Windows program before, you shouldn't have any problems. I recommend you install it into c:\cwRsync; the default location of c:\Program Files\cwRsync can cause some odd problems. For the rest of the article, I'm going to assume you've installed it to c:\cwRsync.
rsync is now installed. Now let's set up some environment variables to make everything work.
Go to the Control Panel and open up System (if you're not using the classic view, you can find it in the Performance and Maintenance section). Click on the Advanced tab, and at the bottom you should see a button labelled Environment Variables. Click on it.
You need to set up two environment variables. Firstly, you need to add the directory c:\cwRsync\bin to your path. You can do this by creating a new user environment variable called PATH and giving it the value c:\cwRsync\bin;%PATH%.


In the same way, you need to add another user environment variable called RSYNC_RSH with the value ssh.exe. When you are finished, you should see something like this:

If you do, click OK twice and move on. If not, leave a comment and I'll try to help.
Open up a command prompt with "Start", "Run..." and "cmd". Run the commands below, changing username to your Strongspace username and subdomain to your Strongspace subdomain. This command will create a directory called testrsync in your Strongspace, and upload the directory c:\cwRsync to it using rsync.
You'll be asked if you want to continue connection (type "yes" and hit enter) and then asked for your Strongspace password. Type that, hit enter, and you should see files begin to upload. Login to Strongspace and make sure the files from c:\cwRsync are there. If so, rsync is now working! If not, leave a comment.
If you don't want to provide a password every time you use rsync, you can set up SSH keys. There's a good explanation of what these are at the PuTTY page on using public key authentication.
Make a new folder in your Strongspace Home account, named ".ssh". Open a new command prompt. You should be in your home directory (in my case, C:\Documents and Settings\David Barrett). If not, cd to it. Then run the following commands:
Now you don't need to type your password to use rsync.
You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.
August 29th, 2005 at 3:01 pm
Sorry - this is all new to me so I’m sure I’m doing something daft, but when I put in the new user environment variable called PATH and give it the value c:\cwRsync\bin;%PATH%, in the view it comes out as new user environment variable called PATH and giving it the value c:\cwRsync\bin;C:\Windows\System32,… I noticed that in the second list (of system variables) there is also a “Path” with C:\Windows\System32 etc so I thought this might have something to do with it. But deleting it doesn’t help. I tried calling the new user environment variable Path1 but obviously that’s not possible either since the subsequent test doesn’t work (returns error message of rsync is not recognised). Can you help…?
Many thanks in advance,
Katherine
August 29th, 2005 at 3:58 pm
Hi Katherine,
%PATH% stands for the existing PATH. When you create the new user environment variable PATH, %PATH% gets replaced with the existing PATH. That’s why C:\Windows\System32,… is appearing there.
Your PATH is where Windows looks for programs. You need to call the environment variable PATH (not Path1) or else Windows will not use it.
I’m not sure why my version of Windows doesn’t show this replacement happening, but it’s fine the way it is. Just keep your user environment variable called PATH and you should be fine.
Any other problems, give me a shout.
August 30th, 2005 at 1:00 am
[…] There’s a new article online: rsync on Windows, with Strongspace. […]
August 30th, 2005 at 1:13 pm
Quick question - what if we already have the PATH variable set for something else? I have Visual Studio installed and there is a path variable set for “C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;” followed by a bunch of other directories within the “\Microsoft Visual Studio\” folder. Any ideas?
August 30th, 2005 at 1:29 pm
Hi Brandon,
In that case, just add “c:\cwRsync\bin;” to the start of the PATH. So, if your existing path is “C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT”, then it will become “c:\cwRsync\bin;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT”.
The PATH variable is used by Windows to find executable files. It’s a list of directories — seperated by colons — that Windows looks in to find executables.
If you try to run an executable — say “rsync” — Windows will look in each directory in the PATH, in order, for an executable called “rsync”. If it finds the executable, it will run it.
August 30th, 2005 at 4:19 pm
Hey Dave,
Thanks for the help - that looks like it did the trick.
So I go ahead and run the command in the DOS window (rsync -avz –delete “/cwRsync” myusername@mysubdomain.strongspace.com:testrsync) all as one line and here’s the output I receive:
———————
building file list … rsync: link_stat “/cwRsync” failed: No such file or directory (2)
done
sent 33 bytes received 20 bytes 5.58 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files could not be transferred (code 23) at main.c(791)
———————
Nothing appears on my strongspace account. Any idea what I’m doing wrong?
August 30th, 2005 at 5:45 pm
Brandon, before you ran that rsync command, did you type “cd c:\”?
August 30th, 2005 at 7:07 pm
Yep, I was at the root level of the c: drive
September 12th, 2005 at 10:56 pm
Dave, Brandon,
I am also totally new to this.
I also ran into a couple of problems with this tutorial. Firstly, my rsync install by default goes into “c:\program files\cwrsync”, not just “cwrsync”. I suppose this will be the cause of Brandon’s error message just as it was for mine.
Secondly, you didn’t mention that you have to do a reboot after adding the PATH variable. Also, this wasn’t so self-evident for me. ;-)
Thirdly, I think you missed a step in your tutorial on key generation. You don’t mention that you have to generate the key inside “.ssh”, otherwise the tutorial doesn’t make sense (”cd .ssh” would be useless, then).
But thanks anyway, in the end everything worked out fine for me.
Best regards,
Bijan
September 12th, 2005 at 10:58 pm
Sorry Dave, stupid me: I didn’t realize that you were actually recommending not to install to “Program Files…”.
;-( Should have read more closely.
Cheers,
Bijan
September 13th, 2005 at 3:49 am
[…] Blog. Strongspace has a blog, and a damn good one. Because right there, second post from the top there’s a tutorial on how to use rsync with Windows. Hmm … rsync. Sounds interesting. Few hours later … […]
September 15th, 2005 at 2:41 pm
Brandon: what version of cwRsync are you using? What version of Windows? What service packs are installed?
I’ve just read that versions 2.0.2 and 2.0.3 are buggy - I’ll be investigating this over the next week, and I’ll try to find a solution.
Bijan: Well, you missed it, which is at least partially my fault, so I’ll edit the article soon to make it more obvious.
September 23rd, 2005 at 8:47 pm
[…] rsync on Windows, with Strongspace […]
September 26th, 2005 at 10:24 am
[…] Tutorial Rsync en strongspace, aquĆ […]
September 29th, 2005 at 10:28 am
Although it makes perfect sense to me I was just wondering if you can explain exactly why the SSH keys should be generated under the user’s profile folder (c:\documents and settings\username\) and not somewhere else.
Also, I’d like to note that more important than just adding the c:\cwrsync\bin path to the environment variables is to understand exactly why that path and no something else. For some of you, as it was for me (probably older version of cwrsync) the cwrsync installation does not have a bin folder. If this is the case then just look for the rsync.exe file (and other *.exe) and map that path instead. For me it’s simply c:\cwrsync.
October 2nd, 2005 at 3:35 am
Has anyone tried rsyncing from Strongspace/Textdrive to a location on your computer other than /cwrsync? Maybe c:/folder_1/folder_2/ or, to make it even more interesting, another_hd:/folder_1/folder_2. Personally I can’t get it to work. I tried it sometime ago and I believe the only way I found to tackle this was by sharing those locations and referring to them as \\shared_name.
AD
October 6th, 2005 at 1:39 am
Yikes… a lot of commments! It’s late, so I’ll get to comments I can answer quickly now and get to the others later (they’ve been flagged for me to answer, I’ll get to them soon).
jpep:
Yes, that’s possible and in fact quite easy to do. If a tutorial is wanted, I’ll write one up.
I think you’re a bit confused about the –delete switch. Say if you sync a local directory to your server, then you delete a file in that directory. When you sync again, rsync will leave the file on the server even though it has been deleted on your end. The –delete switch just deletes the files on the server if they’ve been deleted on the local side.
Adrian Castro:
The SSH keys technically don’t need to be generated under you home directory, but they DO need to be put there so that the rsync command will read them correctly. It’s just easier to generate them where they’ll have to end up anyway.
The problem you seem to be having isn’t down to it being a different location (if I remember correctly). It has to do with having two folders in your path.
Say if a file is in directory B, which is contained within directory A. You try to sync c:\A\B with the server but it won’t sync.
What rsync does is, it tries to look for a directory A on the server, then tries to sync the directory B in that directory A with the local c:\A\B. You can get around this problem in two ways:
1) cd to the directory c:\A, and just sync B.
2) Create a directory A in your Strongspace account.
October 6th, 2005 at 1:46 am
Another note:
jpep, be VERY CAREFUL with the –delete switch. You might end up deleting important information if you screw up while typing a command, something EVERYONE DOES at some stage in their lives. I’ll try to dig up a helpful guide on general rsync usage for you guys and link it at the end of the article.
October 6th, 2005 at 5:28 am
If I have no strongspace account how can I do that?
Any way???
April 13th, 2006 at 9:33 am
hi,
this is braju and i followed the entire article and i installed it and ran upto
cd c:\
rsync -avz –delete “/cwRsync”
but i was struck at username@subdomain wht is all this could any body help me
username@subdomain.strongspace.com:testrsync
thanks
raj;
April 13th, 2006 at 10:34 am
Hi Bhaskar,
username@subdomain should be replaced with your Strongspace username and subdomain. They are usually the same.
My username and subdomain at Strongspace are both “antidis”, so I use “antidis@antidis.strongspace.com:testrsync”.
I hope that helps.
April 13th, 2006 at 10:37 am
Bhaskar: I accidentally deleted your first comment (I deleted it as spam, because I wasn’t looking too carefully!).
It was “hai i installed it in program files and i am not able to test”.
Hopefully this problem has been resolved (given your second comment, it seems to be). If not, I recommend you reinstall the rsync program in the recommended location: c:\cwRsync
May 6th, 2006 at 1:32 am
Dave, thank you for taking the time to write this helpful guide. I’m running into a problem — if you happen to know the solution, please let me know.
I write “rsync -avz –delete “/cwRsync” username@subdomain.strongspace.com:testrsync” in the command prompt, and get a: “‘rsync’ is not recognized as an internal or external command,
operable program or batch file.” message.
There *is* a C:\cwRsync\bin folder in my hard drive (with a “rsync.exe” file in it), and I know I’m setting up the PATH variable correctly (just to test things I’ve added the path to “putty”, and when I typed “putty” in the command prompt, it ran).
Any hints? Whatever the case, thank you for your time!
May 7th, 2006 at 7:14 pm
It’s me again. Rebooting my maching seemed to have done the trick.
Problem now is, when I enter the “rsync -avz…” command above, I get the follwing error (I’ve removed the number following the “sender=” part just in case it’s meant to be private):
===============================================
rsync: Failed to exec ssh.exe: No such file or directory (2)
rsync error: error in IPC code (code 14) at pipe.c(83) [sender=OMITTED]
rsync: connection unexpectedly closed (0 bytes received so far) [sende
r]
rsync error: error in IPC code (code 14) at io.c(463) [sender=OMITTED]
===============================================
Any hints or tips would be greatly appreciated — thanks!
May 9th, 2006 at 1:49 pm
Anyone?
May 14th, 2006 at 7:43 pm
I’ve changed the “RSYNC_RSH” variable to “C:\cwRsync\bin\ssh.exe” and it works now.
May 17th, 2006 at 9:29 pm
Thank you very much for the great tutorial
July 2nd, 2006 at 7:55 am
Great article David and it works a treat. rsync is a fab program and it’s great to see it’s so easy on Windows. Need a pointer however — anyone have this working with dirs/file names containing spaces? This is pretty common on Windows, eg if I want to back up “My Documents” there’s one right there. My problem is with the target directory (ie, the Strongsapce directory) — can’t seem to get the syntax right for that. Anyone help?
July 22nd, 2006 at 12:48 pm
dear dave
i just follow your tutorial,it was work but i’have problem with the end of your tutorial, that how we rsync without password ,it’s doesn’t work for me.i have send the “.ssh/authorized_keys” to another computer.but when i typr:
c:\>del .ssh/authorized_keys
than appear the “Parameter format not correct - “uthorized_key” but iam sure i just type “authorized_key”
so you can help what’s happen
and about another computer we dont do anything?
please help me
best regards
heddot_boy
August 12th, 2006 at 2:26 pm
Those who are getting:
building file list … rsync: link_stat “/cwRsync” failed: No such file or directory (2)
I got round this by changing “/cwRsync” to “cwRsync”
September 11th, 2006 at 2:50 pm
I am also looking for pointers on how to back up files and folders on different drives within my local server. I was able to install rsync on my C drive and tested and it worked fine. then, in thinking i needed to install rsynch on the drive with the files i want to back up, it stopped working. When i tried to backup a file while it was working, I got an error saying both locations cannot be remote.
Thanks
Doug
September 26th, 2006 at 2:35 pm
Doug,
You only need to install cwRsync once, then use a path like the one below in the “from” section of the command:
rsync -varz — delete “/cygdrive/d/source/” “/cygdrive/z/target/”
Where /cygdrive/d/source/ is equivalent to D:\source\
and /cygdrive/z/target/ is Z:\target\
Claude.
January 4th, 2007 at 11:47 pm
Hi, I was able to rsync with a linux machine from a PC, but I cant seem to rsync to the PC, I was wondering if there was anyway i can use this rsync as a server instead of just a client