]> git.donarmstrong.com Git - bin.git/commitdiff
Allow deleting singleton mailboxes master
authorDon Armstrong <don@donarmstrong.com>
Thu, 4 Sep 2025 03:53:26 +0000 (20:53 -0700)
committerDon Armstrong <don@donarmstrong.com>
Thu, 4 Sep 2025 03:53:26 +0000 (20:53 -0700)
deletemailbox

index 9491d4811249bee8c95e732e62b2643441911ca0..6349bc2b0b09c56bc3676b4735ce638bd0ea9dd3 100755 (executable)
@@ -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;
 }