【问题标题】:rsync error when excluding directory: "Unexpected remote arg"排除目录时出现 rsync 错误:“意外的远程 arg”
【发布时间】:2021-03-15 18:12:31
【问题描述】:

我正在尝试将远程文件同步到本地目录。以下命令对我有用:

rsync -avz user@example.com:/remote/path/ /local/path

它询问我的密码,我输入它,然后它开始下载/同步文件。

如果我尝试排除一个目录,但是...

rsync -avz —-exclude='remote/dir' user@example.com:/remote/path/ /local/path

...它会抛出以下错误:

Unexpected remote arg: user@example.com:/remote/path/
rsync error: syntax or usage error (code 1) at main.c(1372) [sender=3.1.3]

【问题讨论】:

    标签: ubuntu rsync


    【解决方案1】:

    正如您在website 中看到的关于 rsync 使用的内容,您可以通过键入以下内容来排除特定目录:

    rsync -a --exclude 'dir1' src_directory/ dst_directory/
    

    将您的命令替换为:

    rsync -avz --exclude='remote/dir' user@example.com:/path/ /local/path

    到这个:

    rsync -avz --exclude 'dir' user@example.com:/home/user/dir /place_to_sync_on_local_machine/

    确保您没有在 --exclude 标志中输入整个地址。只是您要排除的目录。 它应该可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-06
      • 1970-01-01
      • 2017-03-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多