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.



Share this page:

Suggested articles

4 Comment(s)

Add comment

Comments

By: Anonymous

Cannot load inline images after convertion

By: Steve Lloyd


Many thanks for your excellent script, I have made a few modifications to your script, basically removes the need to start script as a sudo/root user unless the required files are not loaded, it then asks for sudo password, also changed the path structure so files are outputted to the user directory, changed also the completion dialog box to use zenity.  See below..
 
 #!/bin/bash
###############################################################################################
###############################################################################################
###############################################################################################
######          This script will help to convert the Microsoft outlook PST file      ##########
######                    into Thunderbird/Evolution compatible format               ##########
######                         On Debian/Ubuntu based Distro's             ##########
######                                 ##########
######                    Original Script created by Srijan Kishore                  ##########
######                         Modified Script by Steve Lloyd                        ##########
######                                 ##########
###############################################################################################
###############################################################################################
###############################################################################################   

#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

# Check to see if readpst is installed and install it if not.

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

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

# Make a folder called outlook in user's home directory

mkdir    ~/outlook

#File selection

readpst  -o  ~/outlook  -r  `zenity --file-selection`

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

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


#Script Completion

find ~/outlook.sbd -empty -type d | xargs -d '\n' rmdir

# Output a text box of completion 

zenity --info --width 800 --title "Outlook Mail Pst Conversion complete" --text "Your outlook Mail pst conversion is now complete, cut and paste the folder outlook.sbd from your home directory into the Local Folder in Thunderbird or Evolution and you can use the folders from there" 

 
 

 

 

 

By: Ken

8/10/2016. Using Ubunto 16.04 with TB 45.  I used the modified script from Steve Lloyd.  After copying and pasting the script to a new file, I had to open in "vi" to remove special characters at the end of each line.  Once that was complete, the script ran flawlessly.  I had to copy each individual newly created file/folder into my "Local Folders" of Thunderbird.  Then just a little reorganization and everything was where I wanted it.  All attachments came through as well. 

I really appreciate the efforts of #####Srijan Kishore and Steve Lloyd#####.

 

By: BOURDEAU Alain

Bonjour en complément après tests, je propose ces adaptations du script :

<quote>mkdir    /home/"user"/outlook#File selectionreadpst  -o  /home/"user"/outlook/  -r `zenity --file-selection` -cv -ufind /home/"user"/outlook/ -type d | tac | grep -v '^/home/"user"/outlook/$' | xargs -d '\n' -I{} mv {} {}.sbdfind /home/"user"/outlook/ -name mbox -type f | xargs -d '\n' -I{} echo '"{}" "{}"' | sed -e 's/\.sbd\/mbox"$/"/' | xargs -L 1 mv#Script Completion# vidage des fichiers cachés restant dans les dossiers vidés des mbox précédemment renommésfind /home/"user"/outlook/ -iname '*.*' -type f -delete# vidage des dossiers précédemment vidésfind /home/"user"/outlook/ -name *.sbd -empty -type d | xargs -d '\n' rmdirgdialog --title "Pst Conversion complete" --msgbox "Your pst conversion is complete,just paste the folder /home/"user"/outlook/*outlook.sbd in Local Folder in Thunderbird/Evolution and you can use the folders there" 200 150</quote>