I'm trying to find all files with given extension but I'm getting this error:
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.
Here is the script:
touch archive.tar.bz2; find . -type f \( -name '*.bak' -o -name '*.c' -o -name '~*' \) -exec tar rjvf archive.tar.bz2 {} \; -exec rm -rf {} \;
Is there any way how to update compressed archive using find?
Best Answer
No, you can't update a compressed archive using
tar
.But, if your script is creating the archive (using
touch
), you can update it and compress it later. Changerjvf
torvf
, and at the end of your script, runbzip2 archive.tar
(I take it from thej
option and your tags that you want to usebzip2
for compression).