Dealing with PST under linux

I prefer dealing with outlook archives (pst-files) by extracting the messages to a folder structure, saving each message as eml-file (Thunderbird mail-format). This can be achieved as follows:

readpst -o 'Archived Messages' -D -j 4 -r -tea -u -w -m ./some.pst

If the command cannot be found, you might need to install the package libpst first. The command creates msg and eml files with a increasing number as the filename.

Then you can go into the different folders and execute the script It renames each eml file with the date and subject in the filename. When I used it it did sometimes throw the following error:

Use of uninitialized value $input in concatenation (.) or string at /usr/share/perl5/vendor_perl/DateTime/Format/ line 154.
Invalid date format:  at ./ line 17.

for that reason I updated the original script to be able to see the filename that cause the issue (it were in fact mails without date information) and to remove them. You find the updated script here:

If you have issues running the script, you might need to install the following packages: perl-File-Slurp, perl-File-Next and perl-DateTime-Format-Flexible


Leave a comment

Your email address will not be published. Required fields are marked *