I'm trying to find all files with given extension but I'm getting this error:tar: Cannot update compressed archivesTry 'tar --help' or 'tar --usage' for more information.tar: Cannot update compressed archivesTry 'tar --help' or 'tar --usage' for more information.tar: Cannot update compressed archivesTry 'tar --help' or 'tar --usage' for more information.tar: Cannot update compressed archivesTry 'tar --help' or 'tar --usage' for more information.tar: Cannot update compressed archivesTry 'tar --help' or 'tar --usage' for more information.tar: Cannot update compressed archivesTry '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?
Can I somehow update compressed archives?
shell script;tar;bzip2
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. Change rjvf to rvf, and at the end of your script, run bzip2 archive.tar (I take it from the j option and your tags that you want to use bzip2 for compression).