
tar コマンドはエラーで失敗します。tar:アーティファクト:ファイルの読み込み中にファイルが変更されました。「リストを除外するために「artifacts」フォルダを追加しましたが、
次のコマンドは、あるシステム(tar 1.28を含むubuntu 16.04)では正しく機能しますが、別のシステム(tar 1.29を含むubuntu 18.04)では毎回失敗します。
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 *