From: Don Armstrong Date: Thu, 4 Sep 2025 03:53:26 +0000 (-0700) Subject: Allow deleting singleton mailboxes X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=HEAD;p=bin.git Allow deleting singleton mailboxes --- diff --git a/deletemailbox b/deletemailbox index 9491d48..6349bc2 100755 --- a/deletemailbox +++ b/deletemailbox @@ -68,10 +68,13 @@ my %options = (debug => 0, man => 0, offlineimap => User->Home.'/.offlineimap', maildir => User->Home.'/Mail', - account => 'lists', + account => 'lists', + single => 1, ); -GetOptions(\%options,'account|a=s','debug|d+','help|h|?','man|m'); +GetOptions(\%options,'account|a=s','debug|d+','help|h|?','man|m', + 'single', + ); pod2usage() if $options{help}; pod2usage({verbose=>2}) if $options{man}; @@ -98,7 +101,12 @@ for my $mbox (@ARGV) { print join(' ',@cmd); system @cmd; # Delete ~/Mail/mbox - @cmd = ('rm','-fr',qq($options{maildir}/$options{account}/$mbox)); + if ($options{single}) { + @cmd = ('rm','-fr',qq($options{maildir}/$mbox)); + + } else { + @cmd = ('rm','-fr',qq($options{maildir}/$options{account}/$mbox)); + } print join(' ',@cmd); system @cmd; }