19

I'm trying to run rsync on Windows with the cwrsync port.

I'm issuing the following command (note that this is just a dry run):

rsync -nPaAz foouser@webxx.example.com:/home/foobar/webapps/barbaz/ C:\\mybackupfolder\

but I get the following error

The source and destination cannot both be remote.
rsync error: syntax or usage error (code 1) at main.c(1148) [Receiver=3.0.8]

Could someone point me in the right direction?

kenorb
  • 26,615
Lorenzo
  • 301

4 Answers4

23

For the destination try using:

/cygdrive/c/mybackupfolder/

Note that a colon tells rsync that the location is remote.

jftuga
  • 3,265
9

My environment: Windows 10, in powershell. Solution also worked in a DOS prompt.

The problem is caused by the : after the drive letters, which makes it look like a hostname specification. You have to use an alternative notation.

I was using rsync installed via Chocolatey, so no cygwin drives.

Windows 10 lets me do this on powershell:

dir //localhost/C$

so, this command, run in a Windows 10 powershell, worked just fine for me, after running into same exact problem.

rsync -av //localhost/d$/home/work/fb460.winbup/src //localhost/d$/home/work/fb460.winbup/tgt
Giacomo1968
  • 58,727
JL Peyret
  • 884
5

Got here from a similar problem with rsync for Windows.

Instead of using the path, just make a .bat file that uses CD C:\whereto\ then in the rsync command just use . as the directory to save to.

Example (something.bat):

@echo off  
cd C:\mybackupfolder\  
rsync -nPaAz foouser@webxx.example.com:/home/foobar/webapps/barbaz/ .  
Gareth
  • 19,080
Vile
  • 51
2

Try

 rsync -nPaAz foouser@webxx.example.com:/home/foobar/webapps/barbaz/ C:/mybackupfolder/
Krumelur
  • 717