linux - 如何将多个 tar 文件合并为一个 tar 文件
问题描述
根据 gnu 文档,要将一个或多个档案添加到另一个档案的末尾,我可以使用“--concatenate”操作。
但是在我的测试中,我发现我一次不能添加多个文件。
# ls -al
total 724
drwxr-xr-x. 3 root root 60 Oct 14 17:40 .
dr-xr-xr-x. 32 root root 4096 Oct 14 16:28 ..
-rw-r--r--. 1 root root 245760 Oct 14 18:07 1.tar
-rw-r--r--. 1 root root 245760 Oct 14 18:07 2.tar
-rw-r--r--. 1 root root 245760 Oct 14 18:07 3.tar
# tar tvf 1.tar
-rw-r--r-- root/root 238525 2021-10-14 17:28 1.txt
# tar tvf 2.tar
-rw-r--r-- root/root 238525 2021-10-14 17:29 2.txt
# tar tvf 3.tar
-rw-r--r-- root/root 238525 2021-10-14 17:29 3.txt
看来它只拾取了第一个参数而忽略了其余的
# tar -A -f 1.tar 2.tar 3.tar
# tar tvf 1.tar
-rw-r--r-- root/root 238525 2021-10-14 17:28 1.txt
-rw-r--r-- root/root 238525 2021-10-14 17:29 2.txt
解决方案
如出色而全面的超级用户回答中所述,
这是 gnu tar 中的一个已知错误(2008 年 8 月报告)
推荐阅读
- c# - 命名复杂类型
- ctakes - 如何在 ctakes-gui 没有任何 jsp 文件时运行 ctakes gui?
- sql-server - 比较具有不同数据类型的两列
- go - 如何在 golang 中记录 apache thrift 请求?
- zapier-cli - zapier cli 应用程序中允许多个
- angular - Angular获取服务响应未定义的响应
- javascript - 如果在类外的函数中声明变量,我如何在类内定义变量
- amazon-web-services - AWS GraphQL Appsync - 无法担任角色
- django - Django 信号识别哪个视图调用
- c# - WPF Combox 使用带有多个源的 Itemteplate