我试图查找具有给定扩展名的所有文件,但收到此错误:
tar: Cannot update compressed archives
Try 'tar --help' or 'tar --usage' for more information.
tar: Cannot update compressed archives
Try 'tar --help' or 'tar --usage' for more information.
tar: Cannot update compressed archives
Try 'tar --help' or 'tar --usage' for more information.
tar: Cannot update compressed archives
Try 'tar --help' or 'tar --usage' for more information.
tar: Cannot update compressed archives
Try 'tar --help' or 'tar --usage' for more information.
tar: Cannot update compressed archives
Try 'tar --help' or 'tar --usage' for more information.
这是脚本:
touch archive.tar.bz2; find . -type f \( -name '*.bak' -o -name '*.c' -o -name '~*' \) -exec tar rjvf archive.tar.bz2 {} \; -exec rm -rf {} \;
有什么方法可以使用 find 来更新压缩档案吗?
答案1
不,您无法使用 更新压缩存档tar
。
但,如果您的脚本正在创建存档(使用touch
),您可以稍后更新并压缩它。更改rjvf
为rvf
,并在脚本末尾运行(我从选项和要用于压缩的标签中bzip2 archive.tar
获取它)。j
bzip2