Script for converting Outlook pst to Thunderbird/Evolution compatible format on Linux

Channel: Linux
Abstract: /bin/bash ############################################################################################### ############################################
Script for converting Outlook pst to Thunderbird/Evolution compatible format on Linux

Version 1.0
Author: Srijan Kishore 

This tutorial will show how to convert Outlook PST into Thunderbird/Evolution compatible SBD format. For this  I have created a script for the conversion format.This will work in Debian/Ubuntu/CentOS too!

 

1. Preliminary Note
I have already my Outlook.pst ready which was extracted from Outlook2010. I assume that you will be having your Sample.pst available with  you.

 

2. Requirement
I have Ubuntu 12.04LTS installed in my machine which have Thunderbird as default mail client. You can also use Evolution as your email client.

Note: As per Microsoft standards any pst file above 5Gb is non-reliable, for storing the mails. So I will suggest to get your Sample.pst file less than 5GB.  3. Script I have simplified the process through the script. Simply copy the script in your clipboard & paste in a text file such as script.sh & save the file.

Script is as follows:-

#!/bin/bash
###############################################################################################
###############################################################################################
###############################################################################################
######          This script will help to convert the Microsoft outlook PST file      ##########
######                    into Thunderbird/Evolution compatible format               ##########
######                         Script created by Srijan Kishore                      ##########
###############################################################################################
###############################################################################################
###############################################################################################  

#check user
if [ "$USER" = 'root' ]
    then
        echo "User check passed"
    else        gdialog --title "User Check" --msgbox "User is not Root. Please run the script as root user." 200 150
        echo "User is not Root. Please run the script as root user."
        exit 1
fi

#OS check
cat /etc/debian_version > /dev/null
if [ $? != 0 ]; then

gdialog --title "OS check" --msgbox "You are not using Debian/Ubuntu, Install readpst package from http://www.five-ten-sg.com/libpst/rn01re01.html" 200 150

else

readpst -V > /dev/null
          if [ $? != 0 ]; then

    apt-get update
    apt-get -y install readpst
    fi
fi

mkdir    ~/home/outlook

#File selection
readpst  -o  ~/home/outlook  -r  `zenity --file-selection`

find ~/home/outlook -type d | tac | grep -v '^~/home/outlook$' | xargs -d '\n' -I{} mv {} {}.sbd

find ~/home/outlook.sbd -name mbox -type f | xargs -d '\n' -I{} echo '"{}" "{}"' | sed -e 's/\.sbd\/mbox"$/"/' | xargs -L 1 mv


#Script Completion
find ~/home/outlook.sbd -empty -type d | xargs -d '\n' rmdir
gdialog --title "Pst Conversion complete" --msgbox "Your pst conversion is complete,just paste the folder ~/home/outlook.sbd in Local Folder in Thunderbird/Evolution and you can use the folders there" 200 150
4. Script Execution Copy paste the script in the file you have created. Give the execute permission to the file y using command chmod

chmod +x script.sh


I will recommend to use the srcipt as root user.It will be done as follows:-

sudo -i                                        #### Put your system login password##########


The script will first confirm that the required package of readpst is installed in your system. Then it will ask to browse the Sample.pst file, just browse & select the file and rest will be done by the script.

After script execution it will generate the folder /home/outlook.sbd

5. Finalization

In Home folder select 'View and select SHOW HIDDEN FILES' or prss ctl+h

It will open the hidden folders in the your home directory.Now browse as .thunderbird-->user.default-->Mail-->Localfolders





Copy paste the folder in the location. Now open the thunderbird from launcher icon on dektop. Right click on the the local folder and create a new folder viz. outlook(as in my case folder name is outlook.sbd).We are done .Just close Thunderbird and open the thunderbird again.


 


Now you will be able to see all your pst mails in Thunderbird.



Ref From: howtoforge

Related articles