Here is a cool script to compress your mail files!

Thomas E. Dukes edukes at alltel.net
Sun May 30 01:47:38 UTC 2004


OUCH!!

On Sat, 2004-05-29 at 20:42, Jason Dixon wrote:
> On May 29, 2004, at 7:53 PM, Jake Johnson wrote:
> 
> > Here is a cool script for anyone that has really big email files and 
> > wants to have them compressed.
> >
> > #!/bin/bash
> > for file in `ls | grep -v gz$ | grep -v sh$`
> > do
> > echo "Compressing $file..."
> > gzip -c $file >> $file.gz
> > rm $file
> > touch $file
> > done
> 
> Not to rain on your parade, but I don't see how this qualifies as a 
> "cool" script.  There's nothing vaguely specific to it about mail file 
> compression.  Not to mention that you didn't provide any real 
> instructions for anyone willing to try it.  Why not just use something 
> like:
> 
> for i in `find $HOME -name *.mbox`; do gzip -c $i >> $i.gz && cat 
> /dev/null > $i; done
> 
> This is no "cooler" than yours, but it's a tad more succinct.  The main 
> advantage is you don't have to worry about grepping out wanted matches, 
> since it's only going to match mbox files (I assume this is what you're 
> aiming for and not Maildir, it's impossible to ascertain by your post). 
>   The other avoiding have to rm && touch files over and over again.  
> Cat'g null into them zeros it out without having to HUP any writing 
> processes or recreate the file.
> 
> P.S.  In the future, please refrain from cross-posting, particularly 
> for something as silly as this.
> 
> --
> Jason Dixon, RHCE
> DixonGroup Consulting
> http://www.dixongroup.net
> 
-- 
Thomas E. Dukes <edukes at alltel.net>





More information about the redhat-list mailing list