![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reg: Gzip | sam99 | Shell Programming and Scripting | 5 | 01-30-2008 07:43 AM |
| tar/gzip/gz...which one to use? | abhijeetkul | UNIX for Advanced & Expert Users | 5 | 03-24-2006 03:00 AM |
| TAR and GZIP help | VandeMatram | UNIX for Dummies Questions & Answers | 3 | 03-17-2006 07:35 AM |
| gzip | alisevA3 | UNIX for Dummies Questions & Answers | 2 | 08-12-2004 11:29 AM |
| gzip | mfran2002 | SCO | 1 | 12-01-2003 10:23 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
tar and gzip
Hi,
I would like to have a combined gzip and tar that will compress and create multiple output tar.gz files. I want to have multiple files output because i cannot create an archive because there is no more space on my harddisk. I cannot transfer it locally because of slow connection. I want to have a script that once it reached the maximum limit (e.g.100MB), it will prompt me to create a new file. Anyone can help? thanks, btw, i already did this $tar cvf - filename.xxx |gzip > filename.tar.gz |
|
||||
|
Tar and gzip
Here is the scenario:
1. I have a 5.7 GB log which i want to archive. However, my problem is the hdisk has no more space available. Solution i want to have : a. create a backup of the file through tar/gzip command but will have a limit of 100MB/file or depending on the maximum limit i will set. It will prompt me that it reached the limit. From there, i can transfer the first file to my local machine and continue creating the next file gz. |
|
|||||
|
#!/bin/ksh
LOGDIR=/home/XXXX ARCHIVE_NAME=/tmp/archive.tar MAX_ARCHIVE_SIZE=XXX # your choice tar -cvf ${ARCHIVE_NAME} for FILENAME in `ls -lrt ${LOGDIR}|awk '{print $9}'` do gzip ${FILENAME} 2>/dev/null tar -rvf ${ARCHIVE_NAME} ${FILENAME}.gz 2>/dev/null rm -f ${FILENAME}.gz 2>/dev/null SIZE=`ls -l ${ARCHIVE_NAME} | awk '{print $5}'` if [[ "${SIZE}" >= "${MAX_ARCHIVE_SIZE}" ]] then move_delete_file; # function to move and delete the archive from LOGDIR fi done Last edited by kamitsin; 06-23-2007 at 04:11 AM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|