Size of a tarball without untarring - Catch parent tar ball has sub tars


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Size of a tarball without untarring - Catch parent tar ball has sub tars
# 1  
Old 04-06-2011
Size of a tarball without untarring - Catch parent tar ball has sub tars

hi,
I am in a weird situation. I have a parent tarball which contains 2 sub tarballs.
The structure is such :
Parent.tar.gz ---- > child1.tar.gz and child2.tar.gz
I need to get the size of the parent tarball without untaring it

I know that the command is
Code:
gunzip -c  parent.tar.gz | wc -c

However this gives me the sizeof parent tarball with the compressed size of the child tarballs. When I actually check the size of child1.tar.gz with the same command its much bigger than the size returned for the parent.tar.gz with the same command.

Can someone guide me as to how to check recuirsivly for the total size of a tar ball ?

Last edited by Yogesh Sawant; 04-09-2011 at 07:32 AM.. Reason: added code tags
# 2  
Old 04-06-2011
There is nothing very odd about the results you describe. If you take 3 files each one megabyte of text and tar them into child.tar you have a roughly 3 megabyte tar file. Now you compress it and get, say a 25 kilobyte child.tar.gz. Now you create a parent.tar which is about 25 kb. If you ry to compress data which is mostly compressed, it won't compress much if at all. So now maybe parent.tar.gz is 24 kb. This is exactly the situation that you disbelieve. parent.tar.gz will expand back to 25 kb. But the child.tar.gz inside it will expand back to 3 MB.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create Tar ball

Hi Team, Following unix command is throwing error. Can anyone please help me to fix the issue? tar -cvf /aa/bb/cc/tarball1.tar /x/y/z1/abc.ksh /x/y/z2/pqr.txt /x/y/z3/lmn.tmp Error message thrown: tar: Removing leading `/' from member names OS: uname -a Linux xyz... (1 Reply)
Discussion started by: kmanivan82
1 Replies

2. Shell Programming and Scripting

Problem creating a tar ball in different directories

Hi all. I'm hitting a problem creating a tar archive in one directory from files located in a different directory. It fails when I replace the absolute paths with variables in the script but works if I just run tar on the cmdln. E.g. #!/bin/ksh BASE=$PWD STAGE=$BASE/stage LOG=$BASE/log... (4 Replies)
Discussion started by: user052009
4 Replies

3. Shell Programming and Scripting

Untar only folder structure from a tar ball

I have a tar file hello.tar which is 95 GB. hello.tar has many files and folders including some tar files as well. I wish to create a new tar ball which should maintain only the folder structure of hello.tar and the tar ball within the hello.tar So basically the idea is to untar... (2 Replies)
Discussion started by: mohtashims
2 Replies

4. Shell Programming and Scripting

Need Tar Ball command to exclude directories

Hi, uname -a SunOS mymac 5.11 11.2 sun4u sparc SUNW,SPARC-Enterprise I need to tar a folder /tmp/moht but do not want these three folders to be included in the tar file -> savejpg, bmpsave and imgsave I tried --exclude, -path, -not options but it says bad option Can you help me with... (3 Replies)
Discussion started by: mohtashims
3 Replies

5. Shell Programming and Scripting

Extract a tar ball into multiple directories

#cat a BAC064DAL BAC063DAL BAC056PHX BAC066DAL BAC062PHX BAC062DAL BAC060DAL BAC058PHX BAC054PHX BAC051PHX # for i in `cat a` > do > tar xvf $a/$a*.tar* > done tar: /*.tar*: Cannot open: No such file or directory tar: Error is not recoverable: exiting now tar: /*.tar*: Cannot... (3 Replies)
Discussion started by: kenshinhimura
3 Replies

6. UNIX for Dummies Questions & Answers

Grep through a .tar file without untarring it

Hi All, I need to grep through a .tar file without untarring it. Would you please help me with that ? The extension to this request is to use the cut command to extract the data from a particular field. Appreciate your quick look around (8 Replies)
Discussion started by: sanjaydubey2006
8 Replies

7. UNIX for Advanced & Expert Users

Extracting directories only from tar ball

Hi Somebody must have done this before, but I can't seem to find any answer on my problem. On HP-UX 11i v3 I have a relatively large tar ball (~120 GB), and I want to create the directory structure only from the archive. There is no option to make a new archive with only the directory... (3 Replies)
Discussion started by: hpvm_adm
3 Replies

8. Shell Programming and Scripting

Extract files from tar ball without directory structure

Hi, I have tar filw which has multiple directories which contain files. When i extract using tar -xf the directory structure also get extracted. I require only files and not directory structures as there will be overhead of moving the files again. So i searched here and got a solution but... (4 Replies)
Discussion started by: chetan.c
4 Replies

9. Shell Programming and Scripting

Extract contents of tar ball without extracting files

Hi, I'm using a tar command tar -xOvf /home/mytar.tar My intention is to extract data in files which are inside various directories, without extracting files to the disk. Is this the best way to achieve it? Thanks, Chetan (3 Replies)
Discussion started by: chetan.c
3 Replies

10. UNIX for Advanced & Expert Users

catch SIGCHLD signal in parent process

I want to catch SIGCHLD signal in parent process. I can't use wait() system call to catch SIGCHLD according to project requirment. Operating system linux 3.1 can any one have a solution for this. Thanking you, ranjan (2 Replies)
Discussion started by: ranjan
2 Replies
Login or Register to Ask a Question