Clean up Mail import?

Mal

macrumors 603
Original poster
Jan 6, 2002
6,253
17
Orlando
I'm working for a client who has, at some point previously, imported mail from a backup or recovery (not sure which) of a previous version of Mail. The problem is, it imported the mail in a series of subfolders for each folder they had set up. For instance, if they have a folder called Bob, the emails are placed in Import -> Mailboxes -> Bob -> 4E2583-2158 -> Data -> 3 -> 2 -> Messages. That's several folders deep from the mailbox where the emails are supposed to be. I want to eliminate all the extraneous mess, which I can do manually by simply dragging the messages from that "Messages" folder where they reside into the great-great-grandparent folder (heh) called "Bob". The problem is, there are hundreds of mailboxes that are all messed up like this, and I don't want to spend the next week dragging messages from one place to another. Is there any way to automate this cleanup? I'm familiar with AppleScript and Automator, so if I have to use one of those to achieve this, that's fine. I couldn't find anything via Google, however.

jW
 

James Craner

macrumors 68000
Sep 13, 2002
1,707
170
Bristol, UK
There is a really easy way - create a smart folder with a search term includes the top level of the recovered messages folder. Then select all the messages in the smart folder and drag them into the folder that you want to keep them.

Smart Mailbox.png
 

Mal

macrumors 603
Original poster
Jan 6, 2002
6,253
17
Orlando
The problem is, they don't all belong in the same mailbox. There are hundreds of mailboxes that are supposed to be there, but then they each have a dozen or so of the ones like I described inside of them. I need to collect them back into each of the real mailboxes, not just into one. That solution, while great for a single collection, would likely take me longer in this case than just doing it manually.

jW
 

Macman45

macrumors G5
Jul 29, 2011
13,196
133
Somewhere Back In The Long Ago
Off-hand, I can't think of another way....Do they really NEED all the old Mail? if so, I'd explain that my bill is going to reflect the time and tedium of the task...They may well decide they don't require it all.
 

GGJstudios

macrumors Westmere
May 16, 2008
44,365
703
Another option is don't try to clean it up. Leave the mail in the folder structure and use search when you need to locate a mail message. In years past, having a complex and strictly administered folder structure was necessary, both in file management and in mail management. As search capabilities have grown, that structure is less important.

For example, I used to create many subfolders for bookmarks, to keep everything neatly organized. Now, I save bookmarks in around a dozen "master" folders, leaving the old folder structure there, but no longer storing bookmarks there... they go in the master folder, rather than the sub-sub-sub-subfolder. Any time I need a bookmark, I search and find it instantly. It's far more efficient than trying to adhere to a more complex folder structure. The same is true for mail and files.
 

James Craner

macrumors 68000
Sep 13, 2002
1,707
170
Bristol, UK
Another option is don't try to clean it up. Leave the mail in the folder structure and use search when you need to locate a mail message. In years past, having a complex and strictly administered folder structure was necessary, both in file management and in mail management. As search capabilities have grown, that structure is less important.

For example, I used to create many subfolders for bookmarks, to keep everything neatly organized. Now, I save bookmarks in around a dozen "master" folders, leaving the old folder structure there, but no longer storing bookmarks there... they go in the master folder, rather than the sub-sub-sub-subfolder. Any time I need a bookmark, I search and find it instantly. It's far more efficient than trying to adhere to a more complex folder structure. The same is true for mail and files.
I completely agree - I never keep any of the emails in inbox, they either get deleted or moved into one of three folders - Action items for items that I need to do something with, that I can't respond to immediately. Or if item needs to be reviewed it goes into the review folder, or if I need to keep it for reference it goes to Archive or my favourite Trash :)

Eventually all my emails either get deleted or moved into Archive and I use mail search /spotlight to find what I need in Archive. Having loads of folders is just so unproductive.
 

Mal

macrumors 603
Original poster
Jan 6, 2002
6,253
17
Orlando
Another option is don't try to clean it up. Leave the mail in the folder structure and use search when you need to locate a mail message. In years past, having a complex and strictly administered folder structure was necessary, both in file management and in mail management. As search capabilities have grown, that structure is less important.

For example, I used to create many subfolders for bookmarks, to keep everything neatly organized. Now, I save bookmarks in around a dozen "master" folders, leaving the old folder structure there, but no longer storing bookmarks there... they go in the master folder, rather than the sub-sub-sub-subfolder. Any time I need a bookmark, I search and find it instantly. It's far more efficient than trying to adhere to a more complex folder structure. The same is true for mail and files.
I completely agree - I never keep any of the emails in inbox, they either get deleted or moved into one of three folders - Action items for items that I need to do something with, that I can't respond to immediately. Or if item needs to be reviewed it goes into the review folder, or if I need to keep it for reference it goes to Archive or my favourite Trash :)

Eventually all my emails either get deleted or moved into Archive and I use mail search /spotlight to find what I need in Archive. Having loads of folders is just so unproductive.
On my computer, that's exactly what I do. If I don't need it, it goes into the trash. If I do, it gets filed in one of a very few folders, mostly the one called Archive. I use search for everything (not just in Mail).

However, this is a client's machine, and leaving it alone was not an option, because Mail was taking ~5-6 minutes to launch to a useable state, and then would freeze or refuse to display messages. I didn't immediately link the problem to the extra mailboxes, but I think Mail was just having so much trouble indexing the contents of all of those nested mailboxes that it couldn't handle it's most basic tasks.

I ended up simple saving the mailboxes manually in the Finder, and deleting them from Mail (the ones in that Import folder only, which I discovered seemed to have been duplicates anyways). If the client needs them, he can still find the messages using Spotlight, but I suspect it won't matter. Mail now launches in under a second and checks for new messages immediately. I was amazed at the difference (even on my machine it doesn't launch that quickly, and I have far less email than this guy did).

jW