linux - In tar compressed file is there a way to add comment or description -


is way add comment or description in tar file? idea add information without need of extracting whole archive - super fast, such "this archive blah blah" example:

tar --comment "this tar blah blah" -cjvf mytarfile.tar.bz2 directory_that_i_want_to_compress 

update found want using zip , unzip instead. can store comment in file within zip archive , retrieve file without need of extracting whole archive. fast.

zip -r my.zip my_dir unzip -p my.zip my_dir/mycomment.txt 

there no comment field in tar format.

you have add file tar archive (e.g. readme or comment file).

adding file compressed tar archive (.tar.bz2 in example), not fast. straightforward way decompress, remove terminating last 1024 bytes of zeros, append tar header , contents final file add, , append 1024 bytes of zeros terminate. recompress.

for .tar.gz, possible reduce work decompressing find last deflate block or blocks containing last 1024 bytes (and some), , recompressing when appending. require advanced use of zlib library, , understanding of deflate format. (see gzappend example.)

something similar might possible .tar.bz2, searching last bwt block, , recompressing that. again, requiring intimate knowledge of compressed data format.

the gzip file format allow comment field in gzip header, bzip2 format not.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -