As I mentioned earlier, my MacBook broke down and went for surgery. It has now been discharged to my workplace with a clean install, but since I’m currently enjoying my last 1.5 months of vacation before I quit the job, I can’t be bothered to start using it again before I definitely have to hand it over to my successor.
The unclean exit of my Mac usage process has resulted in at least one problem so far. I was happily using iCal to schedule events and remember what has happened and what is going to happen (my calendar has always been an extension of my own memory). Before I sent my Mac away, I wasn’t so smart as to export all events into calendar-specific .ics files. On the other hand, I wasn’t even able to do so since the only backups I got was through single user mode. So I decided to export my calendar events myself and start using Google Calendar instead.
The only files I’ve got left from my Mac is a raw copy of my home directory, including the Library with a directory called Calendars. As it turned out, this directory contains one directory per logical calendar in iCal with one .ics file per event. Furthermore, these .ics files can be directly imported into Google Calendar as is. The problem is that there are a lot of these files. Even my iCal, which has been in active use less than half a year, contained 305 events. Importing 305 events one by one into Google Calendar would be a major pain in the ass, so I decided to write a Bash script that combines events from the same logical calendar in iCal into one single .ics file, which can be used to easily import all events into Google Calendar at once.
The script is fairly simple, but still useful for situations like this when you can’t access iCal to export your events. The script can be downloaded from the Projects page. Feel free to use and/or modify it according to your needs.