焦油排除不工作

Ros*_*one 5 linux bash

这个 tar 命令有什么问题?

$ tar --exclude='/tmp/test/exclude-me' -zcvf test.tar.gz test
  test/
  test/c.txt
  test/exclude-me/
  test/exclude-me/b.txt
  test/a.txt
Run Code Online (Sandbox Code Playgroud)

如您所见,exclude-me当我解压缩存档时存在。我也试过了--exclude=/tmp/test/exclude-me/*

Nie*_*jes 6

exclude参数的家庭适用于内部相对的压缩包中的文件的名称。您指定的绝对路径永远不会存在于 tarball 中,因为它只有来自提供的根目录的相对路径。