Computing.Net > Forums > Unix > Help with tar and gzip file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help with tar and gzip file

Reply to Message Icon

Name: gpatel
Date: April 26, 2005 at 18:06:57 Pacific
OS: UNIX
CPU/Ram: 512
Comment:

I have this directories that i am trying to gzip. I am useing this command to tar and then zip it
tar -cf file.tar file1 file2 file3
gzip file.tar
now, my problem is after i gzip it i do not wanted this files to be bigger than 10MB. if they exceed 10MB , i redo the whole process. Is there any eaiser way to do this. can anyone help me do this w/ some kind of scripts or something. thanks a lot
gaurav

thanks,
Gaurav



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: April 27, 2005 at 05:32:37 Pacific
Reply:

# if you have gnu tar, you can combine the tar and gzip operations with
# tar czvf file.tgz file.1 file.2 file.3

if [ `du -sck file.1 file.2 file.3 | awk '/total/ { print $1 }'` -le 10000 ] ;then
tar cvf file.tar file.1 file.2 file.3
gzip file.tar
if [ `du -sk file.tar.gz | awk '{ print $1 }'` -gt 10000 ] ; then
echo "gzip file too large"
fi
fi


0

Response Number 2
Name: gpatel
Date: April 27, 2005 at 14:25:55 Pacific
Reply:

thanks a lotttttt

thanks,
Gaurav


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


unix system rebooted whil... Shell Scripting



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Help with tar and gzip file

tar and gunzip help please www.computing.net/answers/unix/tar-and-gunzip-help-please/2063.html

Help with Bourne Shellscript (More) www.computing.net/answers/unix/help-with-bourne-shellscript-more/5005.html

help with analog.cfg file on virtual ser www.computing.net/answers/unix/help-with-analogcfg-file-on-virtual-ser/3152.html