Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: A Perl script to remove duplicate Mail messages Apps
Tiger only hintWhile using Mail, I found that I inadvertently created many duplicate messages (several thousand, in fact). I looked for some hints on how to handle such a situation, but most seem geared to pre-Tiger releases. So I wrote this Perl script to remove duplicate messages from a mbox-format directory, such as that used by Mail in Tiger.

If you paste the code into a file named undupe (make sure it's executable with chmod 755 undupe), then you can run the script from your ~/Library -> Mail -> Mailboxes directory (assuming that's where you saved the scriptt) as follows:
./undupe 'mailbox 1.mbox' 'mailbox 2.mbox' ...
As usual, I can provide no guarantees that this code will work for you, but it worked well for me. I also highly recommend backing up all of your mail before using this or any other scripts!

[robg adds: A previous hint provided an AppleScript to find duplicates directly within Mail. This hint is a command-line solution to the same problem.]
    •    
  • Currently 3.00 / 5
  You rated: 1 / 5 (4 votes cast)
 
[12,326 views]  

10.4: A Perl script to remove duplicate Mail messages | 4 comments | Create New Account
Click here to return to the '10.4: A Perl script to remove duplicate Mail messages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: A Perl script to remove duplicate Mail messages
Authored by: diamondsw on Jul 05, '05 12:28:18PM

But... Tiger doesn't use the mbox format anymore. All mail messages are split into their own individual files, and the mbox is just a leftover from Panther, unused in Tiger.

Someone please correct me if I'm wrong.



[ Reply to This | # ]
10.4: A Perl script to remove duplicate Mail messages
Authored by: LC on Jul 05, '05 02:54:34PM

It seems to me that the perl script referenced above does a readdir() to collect the message filenames, i.e. it is assuming maildir format; Larry.



[ Reply to This | # ]
10.4: A Perl script to remove duplicate Mail messages
Authored by: swbuehler on Jul 06, '05 10:58:24AM
Apple switched from mbox files to maildir format in 10.4 Mail.app.

[ Reply to This | # ]
A way to do it in Tiger
Authored by: SeanAhern on Aug 07, '05 02:34:38PM

I wrote a python script that does something similar. To make it work on Tiger, I did the following:

1) Install PostfixEnabler and turn on the IMAP server.
2) Configure fetchmail to get your mail from your "real" IMAP/POP server and deliver it locally.
3) Configure Mail.app to use your local IMAP server instead of your "real" one.

Now you've got all the buttery smoothness of Mail.app, yet still have the ability to use UNIX mbox tools on your mail (procmail, mutt, undupe, mairix, etc.)

(Now if only Mail.app had all the power of mairix....)



[ Reply to This | # ]