Search code examples
windowssyntaxcygwinmingw

Cygwin `rsync` Local Folders Paths


I require to synchnorize two folders in a Cygwin or minGW installation between a folder in the current disk and a folder in another disk.

A call such as

rsync -a dir1\ d:\dir2

is illegal, because of the syntaxis of the path in Windows.

ssh: Could not resolve hostname d: Name or service not known

How should i write the paths in Cygwin for this case?


Solution

  • I don't have Cygwin installed currently, but if I recall you're looking for something like:

    rsync -a ./dir1 /cygdrive/c/dir2
    

    Assuming that dir1 is in your current working directory. The problem with what you have provided is that cygwin doesn't know that dir1 is a folder, it's trying to treat it as a hostname (e.g. you can use rsync between different machines with this syntax: me@mycomputer:~/somefolder).

    To remove ambiguity, try:

    rsync -a /cygdrive/d/path/to/dir1 /cygdrive/c/dir2
    

    Where c and d are the drive letters for the particular drives you're looking for.