【问题标题】:Rsync include from and exclude from a listRsync 从列表中包含和排除
【发布时间】:2018-08-29 03:42:03
【问题描述】:

我正在尝试使用 rsync include-from 和 exclude-from 命令来忽略或仅从源中复制列出的文件/目录。该列表位于文本文件中。由于某种原因,该命令不执行。为什么会这样?

代码:

rsync -ar —exclude-from 'exclude-list.txt' source/* destination/

rsync -ar —include-from 'exclude-list.txt' source2/* destination/

在 exclude-list.txt 中:

file1
file2
/dir1
/dir2

【问题讨论】:

标签: bash rsync


【解决方案1】:

您使用了错误的语法。你的命令宁愿是

rsync -ar --exclude-from='exclude-list.txt' source/ destination/

排除部分完全错误,而且来源也没有正确指定。首先你不需要*,然后小心使用关闭/。 - 这意味着不同的东西!

我强烈建议您阅读man-page(至少是您需要的部分)并首先使用-n--dry-run 运行您的命令,看看会发生什么,但不要真正改变任何东西。对于这种情况,-v--stats--progress(甚至--info=FLAGS)可能会很有趣。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-25
    • 2020-03-22
    • 2012-04-14
    • 2018-12-31
    • 2017-02-05
    • 2022-09-26
    • 1970-01-01
    • 2018-02-11
    相关资源
    最近更新 更多