Is there any way to find the compressed size of a file without compressing it in linux


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Is there any way to find the compressed size of a file without compressing it in linux
# 1  
Old 06-03-2011
MySQL Is there any way to find the compressed size of a file without compressing it in linux

i need to backup a directory from one partition to another and and compress that directory after backing up, so i need to predict the compressed size of the directory with out actually compressing it, to check whether the space is available in the destination partition to accommodate the zipped file. is there any way ?
# 2  
Old 06-03-2011
Well, if you mean without uncompressing, it is a function of the tools that compressed the file. Check the man pages for the uncompression tool, to see if it has some list option. Also, you can uncompress to a pipe to wc: "gzcat file | wc -c | read csize", so you uncompress using CPU but need no space for the product.

If you mean the length of a potential compressed version of an uncompressed file, no, but you can do a similar pipe deal" "compress < file | wc -c | read csize"
# 3  
Old 06-03-2011
How well a file compresses depends on its contents, so it's quite difficult to tell in advance. Text tends to compress relatively well. Binary files much less so, though that depends on their composition.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Size of compressed file

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 (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

2. Filesystems, Disks and Memory

Compressed Filesystem for Linux

Hi Everybody: I'm searching a compressed Filesystem for a external disk, what I use for a full, diary and differential Backup. The performance is not important, I search the best option for compress data, but I want have access to structure disk, with directories and files in the Backup disk.... (6 Replies)
Discussion started by: bypper
6 Replies

3. Linux

Find Page size in linux

Hi, How do i find Linux kernel page size using command ? Thanks in advance. (1 Reply)
Discussion started by: forumguest
1 Replies

4. AIX

Compressing the files subject to size - Urgent help

Dear All, I have hunderds of files. I just want to compress all the files which limits to 4GB. that is need compress the files and the zip file should not exceed the 4gb. Can please give me solution for that. Thanks in advance. Kishore (1 Reply)
Discussion started by: tvbhkishore
1 Replies

5. Shell Programming and Scripting

Find all tar and compressed file

Hi, I'm trying to find all tar and compressed files (say gzip). I'm having to assume that the tar and gzip files may or may not have the correct extension (.tar .gz .tgz etc). Any help appreciated (2 Replies)
Discussion started by: andyatit
2 Replies

6. Shell Programming and Scripting

find with file size and show the size

Hi All... is the below command be modified in sucha way that i can get the file size along with the name and path of the file the below command only gives me the file location which are more than 100000k...but I want the exact size of the file also.. find / -name "*.*" -size +100000k ... (3 Replies)
Discussion started by: rpraharaj84
3 Replies

7. Shell Programming and Scripting

How to find size of a file

Hi, I have to directory /usr/inbound ------------- 10900.txt 10889.txt 109290202.txt I need to create inbound directory and i need to know size of these files one by one if file size is zero i need to print message like "empty file" Please help me how to solve this thanks krish. (4 Replies)
Discussion started by: kittusri9
4 Replies

8. Shell Programming and Scripting

find file size

My Question is ----------------- Assume you've a directory (i.e /home/test/) which contains n number of files, rename all the files which has byte count more than zero (0) with .bak extension. Write shell script to achieve this output, execute the same without using". / " in front of... (6 Replies)
Discussion started by: hgriva1
6 Replies

9. Shell Programming and Scripting

To find the RAM size for an Linux server.

Hi Gurus, Can someone let me know how to find the RAM size,ROM size and Number of processors for a linux server. Version :Linux 2.4.9-e.57smp Also what does "e.57smp" stands for? Thanks in advance gurus..... cheers. (3 Replies)
Discussion started by: navojit dutta
3 Replies

10. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies
Login or Register to Ask a Question