If you have an unuse directory and file in a compress archive (.tar) file, and want to remove it without extracting the entire archive. you done by using following steps if you have a big file and don’t want to spend a lot of time extracting and re-archiving. So open up a terminal window and follow as given below.
First of all list compressed tarball named backupfile.tar.gz and verify what type of contents have it by using the –list option.
backupfile
backupfile/fp/
backupfile/fp/sites/
backupfile/resellerfeatures/
backupfile/suspendinfo/
backupfile/logs/
backupfile/mysql/
backupfile/homedir/
Then try to delete the directory called backupfile/logs from the compressed file:
tar: Cannot update compressed archives
tar: Error is not recoverable: exiting now
If you are seeing as above That means you have to uncompress it as modify or delete files operation generally not allowed from compressed file like tar.gz or tar.bz2.
So uncompress the tar.gz archive by using gunzip command as below.
after that try to delete the directory backupfile/logs again:
Now you should not get an error message, so that’s excellent. and verify if it’s delete or not by using –list again:
backupfile
backupfile/fp/
backupfile/fp/sites/
backupfile/resellerfeatures/
backupfile/suspendinfo/
backupfile/mysql/
backupfile/homedir/
Excellent! The directory backupfile/logs has been deleted.