#!/usr/bin/perl -w =head1 NAME md2mb.pl - Import a maildir kmail environment into a thunderbird one =cut use strict; use File::Find; use File::Copy; use File::Basename; use File::Path; use File::Glob ':glob'; use Getopt::Long; use Pod::Usage; use List::Util qw(first); # settings my $cmd = first { system("$_ /dev/null 2>/dev/null") == 0 } qw(formail procmail); $cmd or die < \$debug, 'help|h' => \$help, 'man|m' => \$man, 'oldroot|old|o=s' => \$oldroot, 'profile|p=s' => \$profile, 'subdir|s=s' => \$subdir, ) or pod2usage(2); pod2usage(1) if ($help); pod2usage(-exitstatus => 0, -verbose => 2) if ($man); defined $subdir or pod2usage("Error: -subdir is a mandatory argument\n"); # the new root is constructed from the profile and the chosen subdirectory name my $newroot = "$profile/$subdir"; # debug mode overview if ($debug) { print < Enter debug mode. This will print what would be done. No commands are executed, so this is safe to use when testing. =item B<-help> Print a brief help message and exits. =item B<-man> Prints the manual page and exits. =item B<-oldroot> I Specify where your B mailboxes are to be found. By default assumes a folder called F<.Mail> or F in your homedir, preferring F<.Mail> if it exists. =item B<-profile> I Specify the path to the Thunderbird profile. Your imported mails will go inside a directory in this profile. By default uses the default profile in the F<.thunderbird> directory in your home directory, if it is unique. =item B<-subdir> I Specify the subdirectory I that will be created inside the Thunderbird profile to hold the imported mails. This option is mandatory; there is no default. =back =head1 EXAMPLES # this will fetch all mails from the folder .Mail or Mail in your home # directory, and import them into your default Thunderbird profile, in # a directory called Mail/pop.home.musique-ancienne.org/ # # usually, this is all you need to specify: perl md2mb.pl -s Mail/pop.home.musique-ancienne.org/ # on your computer, the mails may end up in # /users/segolene/.thunderbird/qk2f4dl6.default/Mail/pop.home.musique-ancienne.org/ # if md2mb.pl cannot figure out where your default Thunderbird profile # is, use the following: perl md2mb.pl -p ~/.thunderbird/qk2f4dl6.default -s Mail/pop.home.musique-ancienne.org/ =head1 DESCRIPTION B will import a B maildir environment, and transform it into a B one. It relies on either B or B being available in your search path, and will preferentially use B. By default, B assumes that your B mailboxes are stored in a folder called F<.Mail> or F in your homedir. If this assumption is incorrect, you need to specify the correct folder with B<-oldroot>. The mails will be imported into the Thunderbird profile that is either specified with B<-profile> or determined automatically. The script will try to determine the default Thunderbird profile automatically. If there is a folder that ends in F<.default> in the F<.thunderbird> directory in your home dir, and if it is unique, that one will be used. The mails finally end up in a subdirectory below the profile. You must specify the subdirectory on the command line with B<-subdir>, as shown in the examples above. =head1 AUTHOR =over 4 =item * Bruno Cornec, http://brunocornec.wordpress.com =item * Edward Baudrez, C<< ebaudrez@cpan.org >> =back =head1 LICENSE Released under the GPLv2 or the Artistic license at your will. =cut