Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Long story short, the sysadmins have moved me to a new mailserver. In the process, they needed to create a separate account in Thunderbird and disable my old account. They took care of all of the mail migration.

However, my saved search folders didn't go along for the ride. I have over 20 complex searches that I'd rather not have to reenter manually by hand. You can't drag saved searches between accounts like other folders.

I tried closing Thunderbird, doing a find/replace in virtualFolders.dat in my Thunderbird profile folder, saving that file, and reopening Thunderbird, but that didn't appear to do anything. I'm assuming the search folders are also saved in one of the sqlite databases... does anyone know where to look?

share|improve this question

2 Answers 2

After creating a saved search with a non-sensical name (i.e. something that's not likely to show up in my mail), I found the following references to it in my profile directory:

According to the Phantom Folders mozillaZine article, panacea.dat can be safely deleted, and it will be recreated automatically.

Also according to that page, it looks like the .msf file is needed for your saved search. Try copying that file over from your old profile as well, and you should be all set.

share|improve this answer
    
Thanks! This pointed me in the right direction. –  UltraNurd May 20 '10 at 17:01
up vote 1 down vote accepted

A few notes:

  • Thunderbird apparently doesn't delete saved searches on-disk even after deleting them in the UI, so my IMAP folder for the old server was full of old .msf for searches I wasn't using anymore (so I took this opportunity to not migrate those)
  • At some point Thunderbird switched their file naming convention from "Foo%20Bar.msf" to "Foo Bar.msf", so I had some duplicates (one out of date) from whenever that migration happened (probably Thunderbird 2.x -> 3.x?)
  • In my case, I have my saved searches at the top-level view, not under Inbox, so they appear at ImapMail/server/saved-search.msf
  • The saved search files are small, but contain references to the old hostname that I need to find/replace
  • After migrating the .msf files, verifying them in Thunderbird, and exiting, virtualFolders.dat was updated (which explains why editing this file did nothing and just got overwritten)

Here's the command I ran with Thunderbird not running to migrate the saved search .msfs. Apologies for the bad wrapping:

find ImapMail/oldserver/*.msf -size -5k -and -not -name "*%20*" -and -not -name "Trash.msf" -print0 | xargs -0 perl -e 'foreach $path (@ARGV) { $path =~ /.*\/([^\/]+)/; $filename = $1; print "sed 's/oldserver/newserver/g' \"$path\" > \"ImapMail/newserver/$filename\"\n"; }' | sh

Note that the arguments to find are the ones most likely to change in your situation; I had some filters to remove unused-but-not-quite-deleted old saved searches; the filter on size and to ignore Trash.msf is only necessary because I organize my saved searches at the top level with my other non-virtual folders.

I realize there are probably a bajillion ways to do this multifile find/replace and copy, but this method is my preference since it handles escaping of filenames, and I can inspect what is being matched at each point where the commands are coupled by a pipe.

You'd have to replace the oldserver and newserver path arguments in the call to sed and in the input and output paths. Note the Perl regex that effectively does a basename.

I am very much hoping that there will be a UI way of doing this at some point. I realize this is a special case (saved searches associated with a single account moving to a different account by hostname with identical folder structure), though...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.