Re: Reprocessing a Maildir fodler
Patrick Shanahan <[email protected]>
| Newsgroups | gmane.mail.procmail |
|---|---|
| Organization | Ptilopteri in Pandemonium |
| Message-ID | <[email protected]> |
* LuKreme <[email protected]> [08-19-13 23:12]: > I have a maildir folder with a few thousand emails that I want to > reprocess with the user's current .procmailrc file > > I know how to do this for an mbox file... I used to know how to do it > with a maildir... I would *assume* it is the same but use a directory/* or directory/ rather than a file-name, ie: formail -ds procmail.rc.file < /some/directory/ but I see reference on google: the -s flag to formail splits the input up into seperate mail messages and invokes the selected program (here, procmail) with each message piped into a separate invocation. As Maildir already has one file per message, all you need to do is invoke procmail once per mail message. Something like the following shell: find $YOURMAILDIR/{cur,new} -type f | while read file; do procmail < $file done Note that you probably want to be absolutely sure that procmail doesn't put its output into the maildir you are reading as input. If you want to run this periodically and don't want to send a message to procmail more than once, just move or delete the file once it has been piped to procmail, like this: for dir in cur new; do find $INPUTMAILDIR/$dir -type f | while read file; do procmail < $file mv $file $PROCESSED/$dir # or: rm $file done done http://lists.debian.org/debian-user/2006/06/msg00716.html also: http://does-not-exist.org/mail-archives/mutt-users/msg08674.html for x in .Inbox/cur/* ; do cat $x |formail -ds procmail done So it must require some scripting :^) I only use mbox so haven't had any reason go try.... gud luk, -- (paka)Patrick Shanahan Plainfield, Indiana, USA @ptilopteri http://en.opensuse.org openSUSE Community Member facebook/ptilopteri http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://linuxcounter.net