我正在尝试从映射驱动器向目标发送一些数据,我正在使用系统命令
执行此操作我的代码是
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());
我在控制台上获得的输出是
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]
注意:当我复制相同的命令并在命令提示符下触发时,一切都运行正常。我无法弄清楚出了什么问题。任何想法?
答案 0 :(得分:1)
只有连接cygwin库的应用程序才能访问Cygwin驱动器(例如/cygdrive/Z
)。
您似乎正在使用未与cygwin库链接的Windows本机rsync
,因此它不了解cygdrives。使用来自cygwin发行版的rsync
,即C:\cygwin\bin\rsync.exe
。
或者,首先使用cygpath
utility将cygwin路径(如/cygdrive/Z
)转换为Windows本机路径,然后使用Windows路径。