Hi All,
Is there is any way to find the size of compressed file without doing decompression. The size should give the original uncompressed data size
Thanks
Arun
Hi All,
Is there is any way to find the size of compressed file without doing decompression. The size should give the original uncompressed data size
Thanks
Arun
gunzip -l file.gz
will help you.
Depending on the tool used for compression, the above may do it, but you may also need to consider:-
zcat file.Z | wc
Robin
Hi.
The utility p7zip can deal with many forms of compression:
List of supported formats:
- Packing / unpacking: 7z, ZIP, GZIP, BZIP2, XZ and TAR
- Unpacking only: APM, ARJ, CAB, CHM, CPIO, CramFS, DEB, DMG, FAT,
HFS, ISO, LZH, LZMA, LZMA2, MBR, MSI, MSLZ, NSIS, NTFS, RAR (only
if non-free p7zip-rar package is installed), RPM, SquashFS, UDF,
VHD, WIM, XAR and Z.
For example:
$ file t1.zip
t1.zip: Zip archive data, at least v2.0 to extract
running 7z on this file with "list" directive produces:
$ 7z l t1.zip
7-Zip 4.58 beta Copyright (c) 1999-2008 Igor Pavlov 2008-05-05
p7zip Version 4.58 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU)
Listing archive: t1.zip
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2010-06-07 09:23:38 ..... 160 126 t1.sas7bdat
------------------- ----- ------------ ------------ ------------------------
160 126 1 files, 0 folders
More recent versions, around 9.x, are available in repositories (e.g Debian, SuSE, CentOS, Mac OS X ("brew"), etc).
I don't know if every compression format includes meta-data that can be extracted without uncompressing the file, but p7zip seems worth a try.
The run was in the environment:
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian 5.0.8 (lenny, workstation)
Best wishes ... cheers, drl