ELECTRONS.PSYCHOGENIC.COM NEWS   RAVES & RANTS   GAMES   CONTACT US    
HOME ACCOUNT PRIVATE MESSAGE  
Main Menu

Login

Electrons :: Articles :: Linux iPAQ :: Migrating Palm Address Books to Linux iPAQs
Migrating Palm Address Books to Linux iPAQs
Description: This tutorial describes an automated method for exporting all your Palm Pilot contact info to your Linux iPAQ's gpe-contacts database.

  • 1. Moving PalmOS Contact Info to GPE-Contacts
Moving PalmOS Contact Info to GPE-Contacts

When moving from a system running Palm OS to a GPE install of familiar Linux on a HP/Compaq iPAQ, it's nice to have a way in which to migrate all that wonderful information that has been accumulating on your Clie (or other Palm device). Here we'll detail the process for migrating the addressbook/contact information stored in the Palm.

Requirements

These instructions assume you are working on a Linux or other Unix desktop and have a GPE installation on top of Familiar Linux, running on your iPAQ.

It may be possible to perform the migration to an OPIE installation or from another operating system, the important thing is that your Palm desktop organizer allow you to export your addressbook as vCard data (and you may need to be able to run Perl on your desktop as well). In these cases, filling in the blanks is left as an exercise for the reader.

To perform this migration, you will need:

  1. Your Palm Pilot/Clie/Visor PalmOS device;
  2. A functional installation of the J-Pilot is a desktop organizer application for PalmOS devices;
  3. An iPAQ device, running familiar linux and GPE;
  4. A working SSH connection to your iPAQ;

Exporting the Data

Before you begin, you should have J-Pilot up and running. Make one final hotsync to ensure its got the most recent version of all your contact info. Click on the Address Book icon, then in the menu on "File -> Export".

Select all the addresses you wish to export, select the vCard format, enter a name for the new file, then "OK". The file should now exist and be filled with a series of vCard entries such as:

BEGIN:VCARD
VERSION:3.0
PRODID:-//Judd Montgomery//NONSGML J-Pilot 0.99.8-pre8//EN
UID:palm-addressbook-00cc7029-00002b8a-Pat Deegan@mars.example.com
CATEGORIES:Commercial
FN:Lexmark Optra E310
N:Lexmark Optra E310;
TEL;TYPE=work,pref:800-539-6275
END:VCARD
BEGIN:VCARD
[...]

Attempting to Import

In a perfect world, you would simply transfer the file over to your iPAQ, then use the gpe-contacts application to import the list of vcards.

Unfortunately, at present this method only works for single vCards, and attempting to import a file containing a multitude of cards will only actually import the last one.

GPE-Contacts Import Workaround

Pending our eventual submission of a patch for gpe-contacts or the vcard library, two tricks allow us to get around this. First we begin by splitting up the vCard file into a number of single entry files. Then we do our best to automate importing all these files into gpe-contacts.

On your desktop system, create a directory into which we will place the vcard files and move into it:

	$ mkdir ~/vcards
	$ cd ~/vcards

Save the following perl script onto your desktop system:


#!/usr/bin/perl
   
   my $file = shift @ARGV || die "Gimme a file name to split up";
   
   die "ugh - can't open '$file': $!" unless (open(INFILE, "<$file"));
   
   
   my $contents; # will hold entire vcard file contents
   {
           $/ = undef; 		# undef record separator
           $contents = ;	# in order to slurp in whole file
   }
   
   close(INFILE) || warn "Yo, weird prob closing file $!...";
   
   # create a file for each vcard found
   my $name = 0;
   while ($contents =~ m/(BEGIN:VCARD.*?END:VCARD)/smg)
   {
           my $aVcard = $1; # contents of vcard
	   
	   # output to vcardNNN.txt file
           if (open(OUTFILE, ">vcard$name.txt"))
           {
                   print OUTFILE $aVcard;
                   close(OUTFILE);
                   $name++;
           } else {
   		warn "Could not open vcard$name.txt for write $!";
   	}
   }
For instance, as ~/vcards/vcardsplitter.pl and ensure you make it executable:
	$ chmod a+x ~/vcards/vcardsplitter.pl

From within your vcard directory, run the splitter script by passing it the path to the vCards file exported from J-Pilot, e.g.

	
	$ ./vcardsplitter.pl /path/to/contact.vcards

In a few moments, you should have a number of vcard files in the directory:

	$ ls
	vcard0.txt    vcard136.txt  vcard174.txt  vcard27.txt   vcard65.txt
	vcard1.txt    vcard137.txt  vcard175.txt  vcard28.txt   vcard66.txt
	vcard10.txt   vcard138.txt  vcard176.txt  vcard29.txt   vcard67.txt
	vcard100.txt  vcard139.txt  vcard177.txt  vcard3.txt    vcard68.txt
	vcard101.txt  vcard14.txt   vcard178.txt  vcard30.txt   vcard69.txt
	...

Tar up all those files and move them over to your iPAQ:

	$ tar jcf ~/allMyVcards.tar.bz2 ~/vcards
	$ scp ~/allMyVcards.tar.bz2 user@usbipaq:~/ramdisk/

Finally, log into your iPAQ through SSH and issue the following commands:

	user@h3600:~/ramdisk$ tar jxf allMyVcards.tar.bz2
	user@h3600:~/ramdisk$ cd vcards
	user@h3600:~/ramdisk/vcards$ for i in vcard*.txt; do echo $i; gpe-contacts -i $i; done

For each vCard imported, you should see a small "File vcardNNN.txt imported sucessfully"[sic] dialog appear. Your only, admittedly boring, job is to click ok for each vcard imported. Some imports may fail, and these may need to be retried or entered manually, but most will be imported automatically into your iPAQ contact list.

That's it: your address book information is now stored on your iPAQ. Migrating other useful Palm data should be possible using similar methods, since J-Pilot is cool enough to allow exporting pretty much all the standard Palm-app data. More details to follow in subsequent articles.

Level: Tutorial
Additional Article Data
Level: Tutorial

Comments
The comments are owned by the poster. We aren't responsible for their content.

Jump to section
News

All contents are Copyright (C) 2004-2005 Psychogenic Inc -- All rights reserved