bash 如何更新具有 gzip 压缩的 tar 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8235892/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to update tar file that has gzip compression
提问by
I executed:
我执行了:
tar -Ppcfz backup.tar.gz on /location/
This will: Create a new tar file for the /location/ Preserve paths, Preserve permissions, Compress using gzip
这将:为 /location/ 创建一个新的 tar 文件 保留路径、保留权限、使用 gzip 压缩
I need to later update this tar file with files from /location/ that have not been added or are new:
我稍后需要使用 /location/ 中尚未添加或新的文件更新此 tar 文件:
tar -Ppuf backup.tar.gz /location/
I get errors:
我收到错误:
tar: This does not look like a tar archive tar: Skipping to next header tar: Archive contains obsolescent base-64 headers tar: Unexpected EOF in archive tar: Error is not recoverable: exiting now
tar:这看起来不像 tar 存档 tar:跳到下一个标题 tar:存档包含过时的 base-64 标题 tar:存档 tar 中出现意外的 EOF:错误不可恢复:现在退出
Help please.
请帮忙。
采纳答案by Michael Hoffman
You could try using the -zflag when updating as well, but my version of tar reports that it can't update compressed archives. So you need to gunzipthe file, then update with tar, then gzip.
您也可以-z在更新时尝试使用该标志,但我的 tar 版本报告说它无法更新压缩档案。所以你需要gunzip文件,然后用tar,然后更新gzip。

