singh
singh

Reputation: 439

rsync fails for network mapped drive form c++ code

I am trying to send some data from mapped drive to a destination, i am doing this using system command

My code is

wstring cmd1 = L"\"C:\\Program Files\\cwRsync\\bin\\rsync.exe\" -cvriHPDkREL  --no-implied-dirs --stats /cygdrive/Z/32Bit /cygdrive/C/";
wstring syscmd = L"\"";
syscmd.append(cmd1);
syscmd.append(L"\"");
_wsystem(syscmd.c_str());

The output that i get on the console is

sending incremental file list
rsync: link_stat "/cygdrive/Z/32Bit" failed: No such file or directory (2)

Number of files: 0
Number of files transferred: 0
Total file size: 0 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 3
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 12
Total bytes received: 12

sent 12 bytes  received 12 bytes  48.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1052) [sender=3.0.9]

NOTE : when i copy the same command and fire it on my command prompt, everything works perfectly. I can't figure out what is wrong . any ideas?

Upvotes: 0

Views: 676

Answers (1)

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136266

Cygwin drives (e.g. /cygdrive/Z) are only accessible to applications that link against cygwin libraries.

You seem to be using a Windows-native rsync that is not linked against cygwin libraries and therefore it does not understand cygdrives. Use rsync from cygwin distribution, i.e. C:\cygwin\bin\rsync.exe.

Alternatively, first convert cygwin paths (like /cygdrive/Z) to Windows native paths with cygpath utility and use Windows paths instead.

Upvotes: 1

Related Questions