Duplicated messages in Maildir

Bas van Gils basvg at cs.ru.nl
Sat May 27 10:11:33 UTC 2006


On Sat, May 27, 2006 at 08:38:42AM +1200, Jamie Dobbs wrote:
> Somehow I have ended up with a large number (over 1000!) duplicated 
> messages in one of my Maildir's. Are there any scripts/programs that can 
> go through the Maildir and remove the duplicate messages?

Shouldn't be too hard to hack up something that does what you want. The main
trick is to use the "Message-id" header to find duplicates. Something like:

  message-id-list = []

  foreach mail in maildir{
    id = getId(mail)

    if id in message-id-list {
      remove(mail) # duplicate!
    } else {
      messa-id-list.push( id )
    }
  }

if you're really good then you might be able to do it in a bash onliner..
that's beyond me, though :-)

-- 
<Bas.vanGils at cs.ru.nl> - GPG Key ID: 2768A493  -  http://www.cs.ru.nl/~basvg
Radboud University Nijmegen Institute for Computing and Information Sciences

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20060527/36c37d9b/attachment.sig>


More information about the ubuntu-users mailing list