<<< Date Index >>>     <<< Thread Index >>>

Re: Batch Individual Save?



On 2009-03-06_12:04:58, Rajarajan Rajamani wrote:
> On 09:03 Fri 06 Mar     , Paul E Condon wrote:
> > I find myself in possession of an email folder in which there are
> > close to a thousand emails. These emails are from many different
> > senders. I want to create folders according to sender email address
> > just as would happen if I were to press 's' on each email
> > individually. But when I press 's' I get two prompts that I need to
> > respond to before Mutt actually saves the email into the folder that
> > it has suggested. This is tedious.
> > 
> > But if I tag the whole lot and do ';' and 's', all the emails
> > go to a single folder, based on the sender of ONE of the emails.
> > This is OK for solving some other problem, but not the problem
> > that I have now.
> > 
> > Is there some way of automating what happens when I type
> > 's','\n','\n' over and over again?
> > 
> > FYI, it may make a difference: I am using a maildir format repository
> > for the folders, with no subfolders, either real or apparent. 
> > 
> > TIA
> > 
> > -- 
> > Paul E Condon           
> > pecondon@xxxxxxxxxxxxxxxx
> > 
> If you really wanted to automate it to the extent of being sorted into 
> separate
> folders even before reading it, I would suggest using Procmail to file them.
> For mails already in an mbox I use a script like the following (which is 
> based on procmail being in place with rules for sorting incoming mail into
> folders).
> 

I have read it, long ago. It is an unorganized archive of email dating back to
late 1999. I don't want to toss it, and, to read it again is not something I 
want to do, until I have imposed just a bit of order on it. So, can I do that?

Note added after reading below: Well yes, I think I can.

> Raj
> --------
> #!/bin/sh
> 
> ORGMAIL=/var/mail/$LOGNAME
> 
> if cd $HOME &&
>         test -s $ORGMAIL &&
>         lockfile -r0 -l1024 .newmail.lock 2>/dev/null
> then
>         trap "rm -f .newmail.lock" 1 2 3 13 15
>         umask 077
>         lockfile -l1024 -ml
>         cat $ORGMAIL >>.newmail &&
>         cat /dev/null >$ORGMAIL
>         lockfile -mu
>         formail -s procmail <.newmail &&
>         rm -f .newmail
>         rm -f .newmail.lock
> fi
> exit 0

Thanks for the script. I'll give it a try. I've already learned
a lot just by studying it.

-- 
Paul E Condon           
pecondon@xxxxxxxxxxxxxxxx