I decided to get my toes wet.

I have my mail dirs under ~/Maildirs.

Under each mail dir is a .archiverc which controls a nightly automated
backup of interesting mail dirs.  This program moves old unflagged
seen files into an archive dir, or deletes them for the really boring
mail dirs.  There is one common .archiverc which th eboring ones have
a symlink to.  The interesting mail dirs have a custom .archiverc.

So here is my 'mudd' command which is used as

    mailboxes `~/bin/mudd`

It returns the dirs in a specific order: those with fresh email first,
then those with custom archive files, then those with the canned
archive file, and lastly those with no archive file (I have a couple
of mail dirs where I put copies of mail).  I also have some jun* dirs
used for spam and such.

================
#!/usr/bin/perl -w
use strict;

chdir("$ENV{HOME}/Maildirs") or die "Can't chdir to maildirs: $!";
my @fresh = ();
my @junk = ();
my @custom = ();
my @archived = ();
my @holding = ();
opendir(my $dh, '.') or die ".: $!";
my @all = sort grep { -d "$_/new" } readdir($dh);
closedir($dh);
foreach my $subdir (@all) {
    opendir(my $dh, "$subdir/new") or die "$subdir/new: $!";
    my @new = readdir($dh);
    closedir($dh);
    if (@new != 2) {
        if ($subdir =~ /^jun/) {
            push(@junk, $subdir);
        } else {
            push(@fresh, $subdir);
        }
    } elsif (-l "$subdir/.archiverc") {
        push(@archived, $subdir);
    } elsif (-f "$subdir/.archiverc") {
        push(@custom, $subdir);
    } else {
        push(@holding, $subdir);
    }
}

print join(' ', @fresh, @junk, @custom, @archived, @holding), "\n";
exit 0;
================

I figure this is a nice safe way to start.  The more I use this
sidebar patch, the more I like it.

Which brings up the question of why hasn't it been added to mutt itself?

-- 
            ... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
     Felix Finch: scarecrow repairman & rocket surgeon / fe...@crowfix.com
  GPG = E987 4493 C860 246C 3B1E  6477 7838 76E9 182E 8151 ITAR license #4933
I've found a solution to Fermat's Last Theorem but I see I've run out of room o

Reply via email to