How to restore emlx files in their rightful place (Mail.app)

This might be the wrong place to post this, but I don’t really know where else to try. The story goes like this.

My girlfriend uses mail for business and personal, but never filed any of her emails away. There they were, 2000+ emails all in one folder. I don’t know why, but it drove me nuts and one evening I tried to file them all away, with hideous consequences.

I somehow managed to create two folders with the same name. I then tried to delete the empty one, but of course, as Murphy’s Law dictates, the app deleted both of them.

About 60% of her emails were deleted. No undo, no look in the trash, nothing.

Boy was I in trouble. So I shelled out $80 on FileSalvage, which managed to get them all back. But of course now they come in a single folder with different names (1.emlx, 2.emlx , rather than 6378.emlx etc etc)

Now I’ve got them in a folder on the desktop, and I need to find a way to get them back where they belong. As the details of where they used to be are still stored in the “envelope index”, is there a way of launching terminal and looking at the data in the sql lite db here? Then making some sort of applescript that will save them in the right places?

I’m fairly au fait with applescript, but have no way of finding what the previous names of these files were.

Obviously I’ve learnt my lesson - so no “should have backed it up” responses, please! Girlfriend still very annoyed. And it all happened 6 weeks ago!

According to the missus, chocolate and crow, administered in dosage and frequency proportional to the offense, will eventually secure parole from the doghouse.

I had a similar experience (once) so no soapbox here. In my case, I pulled the emails for safe keeping at the suggestion of AppleCare tech support, but was given incomplete instructions and ended up with emails that were invisible to the message viewer. Many hours of frustration followed, but the incident prompted my to take up AppleScript and keep frequent and multiple backups.

These threads:

http://bbs.applescript.net/viewtopic.php?id=17494

http://bbs.applescript.net/viewtopic.php?id=17538

might help you repeat through the files and add the subject to their names. I suppose you could automate moving them according to that (or To, From, etc.,) without naming them. As for looking at the data in the sql lite db - um, outside of my limited experience.

Hope that helps a little.

j