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