The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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
Script to count files and get the disk usgae on individual mail folders phpfreak Shell Programming and Scripting 1 05-17-2008 01:15 PM
compare files and create new with awk tonet Shell Programming and Scripting 7 12-27-2007 06:05 AM
Create files with one command jess_t03 Shell Programming and Scripting 6 10-09-2007 11:30 AM
on how to create files fiol73 UNIX for Dummies Questions & Answers 2 12-19-2006 03:41 AM
How to compare several files and create a new one alxkn UNIX for Dummies Questions & Answers 1 07-17-2006 08:04 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-28-2008
Registered User
 

Join Date: Apr 2008
Location: New York, NY
Posts: 8
Stumble this Post!
Create individual tgz files from a set of files

Hello
I have a ton of files in a directory of the format app.log.2008-04-04

I'd like to run a command that would archive each of these files as app.log.2008-04-04.tgz

I tried a few combinations of find with xargs etc but no luck.

Thanks
Amit
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-29-2008
vbe vbe is online now
Registered User
 

Join Date: Sep 2005
Location: Switzerland
Posts: 514
Stumble this Post!
The point is that it seems useless to archive a file in an archive individually, if its just to save space then just gzip the lot ... you wont have a file and its archived gzipped alter ego then, but just compressed files...
Reply With Quote
  #3 (permalink)  
Old 04-29-2008
Cameron's Avatar
Registered User
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 486
Stumble this Post!
Archive & GZIP the directory - problem solved.
Reply With Quote
  #4 (permalink)  
Old 04-29-2008
Registered User
 

Join Date: Apr 2008
Location: New York, NY
Posts: 8
Stumble this Post!
Thanks for the response. You're right, I just needed to gzip the files. I do want them individually though (for various reasons). The command that I eventually stumbled on and which works fine is :

for i in `ls -l`; do echo $i; bzip2 $i ; done
Reply With Quote
  #5 (permalink)  
Old 04-29-2008
Registered User
 

Join Date: Apr 2008
Location: New York, NY
Posts: 8
Stumble this Post!
Correction -- it should be

for i in `ls -1`; do echo $i; bzip2 $i ; done

(-1, instead of -l)
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0