Thunderbird Calendar Rearrangement

There are some tasks which are just right for Friday afternoon. I've got a to-do list with a number of urgent items on it, but none of them seem very appealing on a Friday afternoon. Especially when there's a holiday Monday coming up. So of course I not only chose a non-essential item to spend my energies on this afternoon; I chose one which wasn't even on my to-do list.

My calendar in Thunderbird has been bothering me lately. I like to keep all my appointments in it from when I first started using an electronic diary, which is now quite a few years' worth. This makes Thunderbird very unhappy, as it struggles to index and display all the events every time you use the Add-in Calendar (Lightning). Chug chug chug.

And there's another problem. I have an online synchronising service, the excellent Scheduleworld (http://www.scheduleworld.com/) with which I synchronise regularly. While it normally only syncs the events which have changed, Thunderbird will occasionally decide that it really must sync Everything, which it subsequently does. This takes it about 15 minutes, during which time I can't do much with my computer.

So, clearly the smart thing to do is to use Thunderbird's support for multiple calendars to split the calendar up into a static archive of past events, which will never change, and a more dynamic window of events one year either side of the current date. Smart. Except for the fact that Thunderbird doesn't allow you to manipulate calendar items. The idea of deleting events one at a time is a non-starter, so I had to find another way to split the calendar up.

I looked for a few tools around the internet, and considered using google calendar to do it, but eventually hit upon Evolution, which I looked at for an email client once, and rejected in favour of Thunderbird. With hindsight, maybe this wasn't so wise … but anyway, on with the task in hand.

So first of all, you have to export the calendar from Lightning. Using Calendar > Export, you can save your entire database as an .ics file. I imported this into Evolution in a snap. While I was playing around with the editing functions, I found one called Purge. Using this you can get rid of any Calendar items over a certain age. I tried it out, setting it to 7 days, and was left with the last 7 days of regular appointments and all the repeating appointments: birthdays, holidays etc.

That gave me an idea. I removed the remaining regular appointments and just left the repeating ones. I checked through them and they all seemed OK. I used the Calendar Copy feature (right click on the calendar in Evolution) to copy the events to a new calendar which I called Recurring.

Now I imported the original calendar in again and switched to list view, making both calendars visible. For each month you can see the two calendars in different colours. I went through 12 months and removed all the repeating events from the main calendar, so they were properly split into two separate calendars.

Next I copied the main calendar into a third calendar called History. Cutting down the Main calendar was easy: I just ran the Purge command with a value of 300 days. OK, so I was nearly there. I had a Main Calendar with just the last year's worth of events in, and a Recurring Calendar with all Birthdays and Holidays in. Now how to remove the last 300 days of events from the History Calendar?

I tried a few things, but couldn't really figure out a simple way of doing this other than deleting them one by one. I decided to live with a few duplicates: I'd have the History Calendar switched off most of the time anyway.

Now the end was in sight. I exported each calendar file from Evolution into a different file. Next I removed the old calendar information (storage.sdb) from my ~/.mozilla-thunderbird/wkkdkkid8.default profile directory and started up Thunderbird. No Calendar items. Good. I made three calendars, and imported each file into them. First of all the Main calendar, and the Recurring calendar. Those took about 20 seconds each. When I tried to import the Archive one took a good 30 minutes, as Lightning most definitely doesn't live up to its name.

But wait! When I came back to my computer there was a message about 124 duplicate events, which it had skipped importing, because they already existed. Seems that Lightning has some duplicate checking, and that it had refused to import all the events which already existed in the Main calendar, into the Archive calendar. Exactly what I wanted. (But not what I'd planned). A happy accident.

Everything looked good. The three calendars were all different colours and I could switch viewing of them on or off at will. I plan to leave the History one off for 99% of the time and just switch it on when I want to look at it. Everything was running a lot faster without all those unncessary events loaded.

Now to try out a sync with Scheduleworld. I hit the Replace data on Server button and it seemed to work. It marked all my local contacts as new, and pushed them up to the server. I tried a normal sync. Uh-oh. Scheduleworld decided all my calendar items needed to be deleted, so it did so. I re-imported them from the .ics file and tried again. It all seemed to go OK. However this time, when I did a normal sync it duplicated all my contacts for me. Grr.

I went through all my contacts manually deleting every second one. Then I went to Scheduleworld and deleted all the contacts, events, calendars. While I was there I also made a second calendar to hold my recurring events. Now I did one more Replace data on server sync. This time it worked an d I had my contacts synced up on both sides and my two calendars. The History calendar will never change, so I'll just keep a backup of that locally.

All done. All in order. And still time for a cup of tea before the end of the day. However it left me a nagging doubt in my mind: should I really be using Evolution instead of Thunderbird? I'll tackle that in another post.

Leave a Comment