Here is a cool script to compress your mail files!

Mike Burger mburger at bubbanfriends.org
Sun May 30 03:50:58 UTC 2004


On Sat, 29 May 2004, 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

Side note to what everyone else said...

You don't really have to use the -c, pipe it to the gz file, or rm and 
touch the file.

You could probably get away with:

gzip $file
touch $file.

By just issuing gzip against the file, it will automatically add the .gz 
extension to the file, after having compressed it, and the original file 
name will no longer exist.

Running "touch" to recreate the file may not be necessary, either, as 
procmail is usually capable of creating the mail spool file (default 
INBOX, or other files in your maildir) if it doesn't already exist.

-- 
Mike Burger
http://www.bubbanfriends.org

Visit the Dog Pound II BBS
telnet://dogpound2.citadel.org or http://dogpound2.citadel.org:2000

To be notified of updates to the web site, visit 
http://www.bubbanfriends.org/mailman/listinfo/site-update, or send a 
message to:

site-update-request at bubbanfriends.org

with a message of: 

subscribe





More information about the redhat-list mailing list