Changeset 1451 for projects/md2mb/devel


Ignore:
Timestamp:
Apr 4, 2012, 5:14:51 PM (8 years ago)
Author:
ebaudrez
Message:

create empty files for subdirs

Subfolders in KMail lead to directories ending in .sbd, which might not
show up in Thunderbird. This commit automates the process of creating
corresponding empty files to indicate the presence of the subfolders to
Thunderbird.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • projects/md2mb/devel/md2mb/bin/md2mb.pl

    r1450 r1451  
    3737if (@default_profiles) { undef $profile }
    3838my $subdir;
     39my $touch = 0;
    3940
    4041# parse command-line options
     
    4748    'profile|p=s'     => \$profile,
    4849    'subdir|s=s'      => \$subdir,
     50    'touch|t'         => \$touch,
    4951) or pod2usage(2);
    5052pod2usage(1) if ($help);
     
    8688}
    8789find(\&md2mb,($oldroot));
     90
     91# now go back again and create empty files corresponding to the `.sbd'
     92# directories
     93if ($touch) {
     94    print "DESCENDING AGAIN INTO oldroot($oldroot)\n" if ($debug);
     95    find(sub {
     96            return if (! -d);   # consider only directories ...
     97            return if (! /\.sbd$/); # ... with the right name
     98            s/\.sbd//;      # strip .sbd suffix
     99            if ($debug) {
     100                print "WOULD CREATE file($_) IF NEEDED\n";
     101            } else {
     102                open my $fh, '>>', $_ or die "cannot open $_: $!";
     103            }
     104        }, $newroot);
     105}
    88106
    89107# rename `inbox' to `Inbox'
     
    186204   -subdir  | -s        subdir that will be created to hold the
    187205                imported mails
     206   -touch   | -t        create empty files corresponding to .sdb dirs
    188207
    189208=head1 OPTIONS
     
    226245profile to hold the imported mails. This option is mandatory; there is no
    227246default.
     247
     248=item B<-touch>
     249
     250Create empty files corresponding to the F<.sbd> dirs created by this script.
     251Use this hack if your mails don't show up in Thunderbird.
    228252
    229253=back
     
    267291above.
    268292
     293If you have used a structure with subfolders in KMail, mails in subfolders
     294might not show up in Thunderbird. Remove the import, and run again with
     295B<-touch>.
     296
    269297=head1 AUTHOR
    270298
Note: See TracChangeset for help on using the changeset viewer.