Link to home
Create AccountLog in
Avatar of illtbagu
illtbagu

asked on

Converting mbox To Maildir using Perfect_maildir tool

I have been trying to get the Perfect_maildir tool working for an hour now.
http://perfectmaildir.home-dn.net/
From what I understand the syntax should be
./perfect_maildir.pl /home/user/Maildir < /home/user/mail

When I try this I get an error
[user@mail user]$ /home/user/Desktop/perfect_maildir.pl /home/user/Maildir < /home/user/mail
Cannot write to /home/user/Maildir/cur
[user@mail user]$

What the heck am I doing wrong.
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Does /home/user/Maildir exist? If not, create this directory first and try again.
Actually, you also need to create the subdirs tmp new and cur in Maildir:

mkdir ~/Maildir
mkdir ~/Maildir/cur ~/Maildir/tmp ~/Maildir/new

Avatar of illtbagu
illtbagu

ASKER

Thanks for the help.

~/Maildir does exist.

Your suggestion did not work. Here are the results
---------------------------------------------------------------------------------------
[user@mail user]$ mkdir ~/Maildir/cur ~/Maildir/tmp ~/Maildir/new
[user@mail user]$ chown -R user:user Maildir
[user@mail user]$ /home/user/Desktop/perfect_maildir.pl /home/user/Maildir < /home/user/mail
Inserted 0 messages into maildir /home/user/Maildir in 0 seconds
----------------------------------------------------------------------------------------

Thanks,
AD
It does work for me. What is "mail"? What does "file /home/user/mail" print?
I just tried it again on a different machine, and it still works ...
/home/user/mail is the directory where all of my mail is stored in mbox format.

[user@mail user]$ file /home/user/mail
/home/user/mail: directory
[user@mail user]$
ASKER CERTIFIED SOLUTION
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Ok that works. Thanks very much. I am very disappointed, I thought this script was capable of converting an entire users mailbox from mbox to maildir. Thats why I was pointing the script at the mbox directory instead of the actual mbox. Could you imagine tryng to convert hundreds or even thousands of uses mailboxes from mbox to maildir with this tool. I guess its better than nothing. There is just alot of manual work that needs to be done in order to convert an entire mbox directory over to maildir with this script.

I will try and use mbox2maildir again.
http://batleth.sapienti-sat.org/projects/mb2md/
I have actually been fighting trying to get either one of these tools to work for me. I actually started off using the mbox2maildir script but I keep getting errors. Frustration just got the best of me I guess. Sometimes frustrtion makes you stupid :)
------------------------------------------------------------------------------
[user@mail user]$ mb2md-3.20.pl -s mail -l .mailboxlist -R -d Maildir
Can't locate Date/Parse.pm in @INC (@INC contains: /usr/lib/perl5/5.8.3/i386-linux-thread-multi /usr/lib/perl5/5.8.3 /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at /usr/bin/mb2md-3.20.pl line 385.
BEGIN failed--compilation aborted at /usr/bin/mb2md-3.20.pl line 385.
[user@mail user]$
------------------------------------------------------------------------------
No matter what I do I get this error. On line 385 of this script it says
use Date::Parse;

Any ideas?

Thanks for your help.
I'm not familiar with this tool. Give me some time to download/install/investigate.

Regarding the directories vs. individual files: You can probably create a script that searches for all files in the user's mail directory and then recreates this structure in Maildir form. The challenge is to actually recreate the structure. If you had someting in it's own mail folder, you want to create a new directory under Maildir (with the three subdirs) and use this directory as output directory.
I rewarded you for your help on my original question and I have open up another concerning the mbox2maildir tool. This is only fair to you.
https://www.experts-exchange.com/questions/20942581/mbox2maildir-script-not-working.html

Thanks again,
AD
I suspect that it's a missing Perl module. If you check the download link at http://batleth.sapienti-sat.org/projects/mb2md/#Download it states that this program requires TimeDate.

It's very likely that this Perl module is part of your Linux distribution, and you just have to install it. If you don't find it on your installation CDs, you can download it from here: http://www.perl.com/CPAN/modules/by-module/Time/TimeDate-1.16.tar.gz 
Sorry, didn't see your last comment. I'll post the comment in the new question again.