gpt4 book ai didi

c++ - 对于网络映射驱动器形式的 C++ 代码,rsync 失败

转载 作者:行者123 更新时间:2023-11-28 07:06:01 24 4
gpt4 key购买 nike

我正在尝试将一些数据从映射驱动器发送到目的地,我正在使用系统命令执行此操作

我的代码是

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]

注意:当我复制相同的命令并在我的命令提示符下启动它时,一切正常。我不知道哪里出了问题。有什么想法吗?

最佳答案

Cygwin 驱动器(例如 /cygdrive/Z)只能由链接到 cygwin 库的应用程序访问。

您似乎正在使用未链接到 cygwin 库的 Windows 原生 rsync,因此它不理解 cygdrives。使用来自 cygwin 发行版的 rsync,即 C:\cygwin\bin\rsync.exe

或者,首先使用 cygpath utility 将 cygwin 路径(如 /cygdrive/Z)转换为 Windows native 路径并改用 Windows 路径。

关于c++ - 对于网络映射驱动器形式的 C++ 代码,rsync 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21753957/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com