5

我正在尝试将包含文件和文件夹的目录复制到另一个目录,首先在本地进行测试,然后再复制到远程服务器。我必须使用的工具是rsync,但经过大量测试和阅读文档后,我无法使其在Windows 7.

例如,当我尝试

rsync -av D:\source\ D:\dest\

我得到错误The source and destination cannot both be remote.

当我尝试rysnc -av \source\ D:\dest\时,我得到Error: Failed to exec ssh: No such file or directory (2)

你知道我怎样才能让它工作吗?

谢谢你。

4

2 回答 2

6

Cygwin 路径不同,使它们类似于 Unix。利用

rsync -av /cygdrive/d/source/ /cygdrive/d/dest/ 

D:被解释为一个名为 D 的远程服务器

于 2013-01-28T12:45:56.353 回答
0

掘墓人回来挖这个——

在我的 Windows 8.1 机器上,一切正常,但在我的 Windows 7 机器上,我遇到了同样的问题。通过编辑 vagrant 的源来修复它 -

对我来说它就在这里 - C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\synced_folders\rsync\helper.rb

我添加了 cygdrive 作为前缀,一切顺利 -

    if Vagrant::Util::Platform.windows?
      # rsync for Windows expects cygwin style paths, always.
      # Editing source is never fun, but it works : /
      hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath)
    end
于 2014-08-11T16:23:34.413 回答