Changeset 1449 in ProjectBuilder for projects/md2mb
- Timestamp:
- Apr 4, 2012, 5:14:49 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
projects/md2mb/devel/md2mb/bin/md2mb.pl
r1448 r1449 26 26 Aborting 27 27 EOF 28 my $oldroot = first { -d } "$ENV{HOME}/.Mail", "$ENV{HOME}/Mail";29 28 # CHANGE AS YOU WISH 30 my $newroot = "/users/segolene/.thunderbird/qk2f4dl6.default/Mail/pop.home.musique-ancienne.org/";31 29 # Is the newroot a file (1) or a dir (0) 32 30 my $nrisfile = 0; … … 35 33 my $help = 0; 36 34 my $man = 0; 35 my $oldroot = first { -d } "$ENV{HOME}/.Mail", "$ENV{HOME}/Mail"; 36 my @default_profiles = bsd_glob("$ENV{HOME}/.thunderbird/*.default"); 37 my $profile = shift @default_profiles; 38 # if there is more than one default profile (quite unlikely, but you never 39 # know), unset $profile again and let the user resolve this 40 if (@default_profiles) { undef $profile } 41 my $subdir; 37 42 38 43 # parse command-line options 39 44 GetOptions( 40 'debug|d' => \$debug, 41 'help|h' => \$help, 42 'man|m' => \$man, 43 'oldroot|old|o' => \$oldroot, 45 'debug|d' => \$debug, 46 'help|h' => \$help, 47 'man|m' => \$man, 48 'oldroot|old|o=s' => \$oldroot, 49 'profile|p=s' => \$profile, 50 'subdir|s=s' => \$subdir, 44 51 ) or pod2usage(2); 45 52 pod2usage(1) if ($help); 46 53 pod2usage(-exitstatus => 0, -verbose => 2) if ($man); 54 defined $subdir or pod2usage("Error: -subdir is a mandatory argument\n"); 55 56 # the new root is constructed from the profile and the chosen subdirectory name 57 my $newroot = "$profile/$subdir"; 47 58 48 59 # debug mode overview … … 53 64 cmd = $cmd 54 65 oldroot = $oldroot 55 newroot = $newroot 66 profile = $profile 67 subdir = $subdir 68 newroot = $newroot (constructed) 56 69 --- end --- 57 70 EOF … … 60 73 # some sanity checks before proceeding 61 74 -d $oldroot or die "cannot find mailbox root `$oldroot'"; 75 -d $profile or die "cannot find Thunderbird profile directory `$profile'"; 62 76 63 77 # create destination path … … 163 177 =head1 SYNOPSIS 164 178 165 md2mb.pl [options] 179 md2mb.pl [options] -s name 166 180 167 181 Options: … … 170 184 -man | -m full documentation 171 185 -oldroot | -old | -o location of the KMail mailboxes 186 -profile | -p path to the Thunderbird profile to install to 187 -subdir | -s subdir that will be created to hold the 188 imported mails 172 189 173 190 =head1 OPTIONS … … 188 205 Prints the manual page and exits. 189 206 190 =item B<-oldroot> 207 =item B<-oldroot> I<path> 191 208 192 209 Specify where your B<KMail> mailboxes are to be found. By default assumes a … … 194 211 exists. 195 212 213 =item B<-profile> I<path> 214 215 Specify the path to the Thunderbird profile. Your imported mails will go inside 216 a directory in this profile. By default uses the default profile in the 217 F<.thunderbird> directory in your home directory, if it is unique. 218 219 =item B<-subdir> I<name> 220 221 Specify the subdirectory I<name> that will be created inside the Thunderbird 222 profile to hold the imported mails. This option is mandatory; there is no 223 default. 224 196 225 =back 226 227 =head1 EXAMPLES 228 229 # this will fetch all mails from the folder .Mail or Mail in your home 230 # directory, and import them into your default Thunderbird profile, in 231 # a directory called Mail/pop.home.musique-ancienne.org/ 232 # 233 # usually, this is all you need to specify: 234 235 perl md2mb.pl -s Mail/pop.home.musique-ancienne.org/ 236 237 # on your computer, the mails may end up in 238 # /users/segolene/.thunderbird/qk2f4dl6.default/Mail/pop.home.musique-ancienne.org/ 239 240 # if md2mb.pl cannot figure out where your default Thunderbird profile 241 # is, use the following: 242 243 perl md2mb.pl -p ~/.thunderbird/qk2f4dl6.default -s Mail/pop.home.musique-ancienne.org/ 197 244 198 245 =head1 DESCRIPTION … … 206 253 incorrect, you need to specify the correct folder with B<-oldroot>. 207 254 255 The mails will be imported into the Thunderbird profile that is either 256 specified with B<-profile> or determined automatically. The script will try to 257 determine the default Thunderbird profile automatically. If there is a folder 258 that ends in F<.default> in the F<.thunderbird> directory in your home dir, and 259 if it is unique, that one will be used. 260 261 The mails finally end up in a subdirectory below the profile. You must specify 262 the subdirectory on the command line with B<-subdir>, as shown in the examples 263 above. 264 208 265 =head1 AUTHOR 209 266
Note:
See TracChangeset
for help on using the changeset viewer.