]> git.donarmstrong.com Git - bin.git/blob - deletemailbox
add reset usb bus command
[bin.git] / deletemailbox
1 #! /usr/bin/perl
2 # ss makes a screenshot of the screen using import, and is released
3 # under the terms of the GPL version 2, or any later version, at your
4 # option. See the file README and COPYING for more information.
5 # Copyright 2004 by Don Armstrong <don@donarmstrong.com>.
6 # $Id: ss,v 1.3 2004/09/27 05:58:55 don Exp $
7
8
9 use warnings;
10 use strict;
11
12
13 use Getopt::Long;
14 use Pod::Usage;
15
16 use POSIX qw(strftime);
17
18 =head1 NAME
19
20 deletemailbox -- deletes a mailbox and the offlineimap information corresponding to that mailbox
21
22 =head1 SYNOPSIS
23
24 ss [options] mailbox
25
26  Options:
27   --account, -a account (Default lists)
28   --debug, -d debugging level (Default 0)
29   --help, -h display this help
30   --man, -m display manual
31
32 =head1 OPTIONS
33
34 =over
35
36 =item B<--account, -a>
37
38 Name of the account from which the folder will be deleted
39
40 =item B<--debug, -d>
41
42 Debug verbosity. (Default 0)
43
44 =item B<--help, -h>
45
46 Display brief useage information.
47
48 =item B<--man, -m>
49
50 Display this manual.
51
52 =back
53
54 =head1 EXAMPLES
55
56 deletemailbox -a lists rnm-devel
57
58 =cut
59
60
61 use User;
62 use vars qw($DEBUG);
63
64 # XXX parse config file
65
66 my %options = (debug           => 0,
67                help            => 0,
68                man             => 0,
69                offlineimap     => User->Home.'/.offlineimap',
70                maildir         => User->Home.'/Mail',
71                account         => 'lists',
72               );
73
74 GetOptions(\%options,'account|a=s','debug|d+','help|h|?','man|m');
75
76 pod2usage() if $options{help};
77 pod2usage({verbose=>2}) if $options{man};
78
79 $DEBUG = $options{debug};
80
81
82 for my $mbox (@ARGV) {
83      # Delete ~/.offlineimap/Repository-{Local,Remote}Lists/FolderValidity/mbox
84      # initialcaps account needed for the account name
85      my @cmd = ('rm','-f',qq($options{offlineimap}/Repository-Local).
86           ucfirst($options{account}).
87                qq(/FolderValidity/$mbox));
88      print join(' ',@cmd);
89      system @cmd;
90      @cmd = ('rm','-f',qq($options{offlineimap}/Repository-Remote).
91           ucfirst($options{account}).
92                qq(/FolderValidity/$options{account}.$mbox));
93      print join(' ',@cmd);
94      system @cmd;
95      # Delete ~/.offlineimap/Account-Lists/mbox
96      @cmd = ('rm','-fr',qq($options{offlineimap}/Account-).ucfirst($options{account}).
97              qq(/LocalStatus/$mbox));
98      print join(' ',@cmd);
99      system @cmd;
100      # Delete ~/Mail/mbox
101      @cmd = ('rm','-fr',qq($options{maildir}/$options{account}/$mbox));
102      print join(' ',@cmd);
103      system @cmd;
104 }
105
106
107
108 __END__