tar: FOLDER: 文件在我们读取时已更改,但添加了 FOLDER 以排除

tar: FOLDER: 文件在我们读取时已更改,但添加了 FOLDER 以排除

tar 命令失败并出现错误“tar:工件:文件在我们读取时发生了变化“虽然我添加了文件夹“artifacts”来排除列表

以下命令在一台机器上运行良好(ubuntu 16.04 with tar 1.28),但在另一台机器上每次都会失败(ubuntu 18.04 with tar 1.29)

tar -zcf artifacts/source_code.tar.gz * --exclude=artifacts

我想压缩当前目录中的所有文件和文件夹,不包括我放置 tarball 的目录。请注意,此命令正在运行

答案1

当我执行该命令时,我收到以下消息:

$ tar -zcf artifacts/source_code.tar.gz . --exclude=artifacts
tar: The following options were used after any non-optional arguments in archive create or update mode.  These options are positional and affect only arguments that follow them.  Please, rearrange them properly.
tar: --exclude ‘artifacts’ has no effect
tar: Exiting with failure status due to previous errors

所以你必须把第--exclude一个:

tar -zcf artifacts/source_code.tar.gz --exclude=artifacts *

相关内容