Re: Here is a cool script to compress your mail files!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux