How to know the Original size of the file without unzipping the File?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to know the Original size of the file without unzipping the File?
# 1  
Old 01-03-2012
How to know the Original size of the file without unzipping the File?

Hi,

I don't have enough space on my Unix Box. So, I can't unzip the file and check the size of the file. So, I need to know, Is there any command, to check, how much the unzipped file takes after unzipping. Thanks in Advance.
# 2  
Old 01-03-2012
You can try uncompressing it to stdout and piping it to wc to get a byte count.

Code:
gzip -dc file.gz|wc

This User Gave Thanks to agama For This Post:
# 3  
Old 01-03-2012
try gzip -l file.gz

From man gzip:

Quote:
-l --list
For each compressed file, list the following fields:

compressed size: size of the compressed file
uncompressed size: size of the uncompressed file
ratio: compression ratio (0.0% if unknown)
uncompressed_name: name of the uncompressed file

The uncompressed size is given as -1 for files not in gzip format, such as compressed .Z files. To get the uncompressed size for such a file, you can
use:

zcat file.Z | wc -c

In combination with the --verbose option, the following fields are also displayed:

method: compression method
crc: the 32-bit CRC of the uncompressed data
date & time: time stamp for the uncompressed file

The compression methods currently supported are deflate, compress, lzh (SCO compress -H) and pack. The crc is given as ffffffff for a file not in
gzip format.
This User Gave Thanks to dude2cool For This Post:
# 4  
Old 01-03-2012
Quote:
Originally Posted by dude2cool
try gzip -l file.gz
I had it in my brain that -t did that, but it (obviously) doesn't. Should have read the man page Smilie
# 5  
Old 01-04-2012
MySQL

Thanks a lot aagma.. its working...Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find the original file size of encrypted file

Hi, I am trying to find out the original file size of an encrypted file in SunOS. The file was decrypted with gpg command. I want to know the size of the orginal file without decrypting it. I am using the below command, but it is not working for big files(more than 1 GB). gpg --passphrase... (4 Replies)
Discussion started by: vsachan
4 Replies

2. UNIX for Dummies Questions & Answers

Print Only File Name in Zip File With out Unzipping It

How i print just only the file name in the zip file. unzip -l AAC_20130930_v13.xml.zip Archive: AAC_20130930_v13.xml.zip Length Date Time Name -------- ---- ---- ---- 62665745 11-19-13 10:43 AAC_20130930_v13.xml -------- ------- 62665745 ... (2 Replies)
Discussion started by: Ariean
2 Replies

3. Shell Programming and Scripting

How to remove new line in file after unzipping the file?

I wrote my unix archive script to move the zip files from unix input folder to windows folder,the zip files got successful transfered but while iam unzipping them in windows folder a new line is getting appended in my file.. how can i remove that new line..? (6 Replies)
Discussion started by: hemanthsaikumar
6 Replies

4. Shell Programming and Scripting

Get original file size of zipped file

Hi, I have a process which creates files and gzip all the files. Next day, i need to get the file sizes ( before zip size ) of all the gzipped files. Is there any way i can get the original file sizes of gzipped files. Gunzipping the files, getting the file size and gzipping again is not the... (6 Replies)
Discussion started by: forums123456
6 Replies

5. UNIX for Dummies Questions & Answers

CSV file:Find duplicates, save original and duplicate records in a new file

Hi Unix gurus, Maybe it is too much to ask for but please take a moment and help me out. A very humble request to you gurus. I'm new to Unix and I have started learning Unix. I have this project which is way to advanced for me. File format: CSV file File has four columns with no header... (8 Replies)
Discussion started by: arvindosu
8 Replies

6. Shell Programming and Scripting

Unzipping the file

I have my folder structure like a file a.zip is placed in one folder. Inside a.zip is two other zip files x.zip and y.zip If i unzip x.zip i have folder a folder z and inside folder z there are different folders with event time appended to it. Inside the every event folder ,I have a sub folder... (1 Reply)
Discussion started by: weknowd
1 Replies

7. Shell Programming and Scripting

The scripts not able to make the file to size 0, every times it go back to its original size

#!/bin/sh ########################################################################################################## #This script is being used for AOK application for cleaning up the .out files and zip it under logs directory. # IBM # Created #For pdocap201/pdoca202 .out files for AOK #1.... (0 Replies)
Discussion started by: mridul10_crj
0 Replies

8. Shell Programming and Scripting

Unzipping a file in Solaris - Issue with xls file

Hi, I have an excel file generated by system in windows. I am zipping it, transfering to unix and unzipping there. But i'm getting below output while unzipping. $ /usr/bin/unzip -a 123.zip -d . Archive: 123.zip inflating: ./123/Index.xls When i copy this unzipped xls file to... (0 Replies)
Discussion started by: ajaykumarb
0 Replies

9. Shell Programming and Scripting

How to search a pattern inside a zipped file ie (.gz file) with out unzipping it

How to search a pattern inside a zipped file ie (.gz file) with out unzipping it? using grep command.. Bit urgent.. pls..help me (2 Replies)
Discussion started by: senraj01
2 Replies
Login or Register to Ask a Question