Free Open Diary Import

Well, I’ve imported all my old OpenDiary entries. Unfortunately, there’s no easy way to export all the notes from OD, so they haven’t made their way across.

Below is the perl script I used to convert ODs export format into the MovableType import format:

#!/usr/bin/perl

{
open ODFILE,”< $ARGV[0]"; @entries=(); while($_ = )
{
if(/^(.*?)\s+\- (\d\d?\/\d\d?\/\d\d\d\d)/)
{
$entries[$#entries+1]=[$1,$2,”];

}
else
{
s/\x0d//g;
my $entry = $entries[$#entries];
${@$entry}[2].=$_;
}
}
close ODFILE;
}

my $i=0;
foreach my $entry (@entries)
{
print “TITLE: “.@$entry[0].”\n\n”;
@date = split /\//,@$entry[1];
print “DATE: $date[0]/$date[1]/$date[2] 00:00:00\n”;
print “—–\n”;
print “BODY:\n”;
print @$entry[2];
print “

One thought on “Free Open Diary Import

  1. Hey, thanks for posting this! I was just thinking I was going to need to write something like this, and then I stumbled across your script through Google. (And ironically enough, I was actually searching for something else when I found it.)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.