0

Is it possible to find out, what will be size of a directory after extract ?

If I do have a tar file in gz,bz2 or xz format of 1GB then is there any way to know beforehand that this tar file will need so much size for extracting the content ?

0

2 Answers 2

1

An uncompressed tarball is approximately the same size as its extracted contents, so you can get a very good idea of the extracted size by determining the size of the original tarball (pre-compression):

xz -l tarball.tar.xz
gzip -tl tarball.tar.gz

respectively for xz and gzip (although gzipped files larger than 4GB won't report the correct size).

bzip2 doesn't appear to have an option to show the size of the file before compression, so the easiest option is to decompress and count:

bunzip2 -c tarball.tar.bz2 | wc -c

which also works for large gzip files:

gunzip -c tarball.tar.gz | wc -c
0

check here...

https://stackoverflow.com/questions/2712173/check-the-total-content-size-of-a-tar-gz-file

$ tar tzvf archive.tar.gz | sed 's/ \+/ /g' | cut -f3 -d' ' | sed '2,$s/^/+ /' | paste -sd' ' | bc

gzsize <your file>

Not the answer you're looking for? Browse other questions tagged .