【问题标题】:what does --exclude do in tar command when use like this "tar cvfz ../xxx --exclude './yyy/**' "?当像这样使用“tar cvfz ../xxx --exclude './yyy/**'”时,--exclude 在 tar 命令中会做什么?
【发布时间】:2012-03-09 14:16:49
【问题描述】:

我看到这个命令:
tar cvfz ../xxx --exclude './yyy/**'

xxx 和 yyy 只是目录。

现在,我无法理解 --exclude 参数之后的 ** 是什么?

我认为这种模式是外壳的一部分!!!

【问题讨论】:

    标签: shell unix


    【解决方案1】:

    ** 表示“*递归”(在子目录中,不仅在正确的目录中),包括斜杠。

    foo/**/bar
    

    表示“foo”的任何子目录中的“bar”。

    【讨论】:

      【解决方案2】:

      来自 tar 手册页:

       --exclude pattern
           Do not process files or directories that match the specified pattern.
      

      因此,对于您的情况,它排除yyy/ 目录中的所有文件和子目录,并通过将排除模式指定为./yyy/**' 来进一步归档。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-01-11
        • 1970-01-01
        • 2018-07-31
        • 1970-01-01
        • 2020-08-04
        • 1970-01-01
        • 1970-01-01
        • 2016-10-15
        相关资源
        最近更新 更多