#! /usr/bin/perl # ss makes a screenshot of the screen using import, and is released # under the terms of the GPL version 2, or any later version, at your # option. See the file README and COPYING for more information. # Copyright 2004 by Don Armstrong . # $Id: ss,v 1.3 2004/09/27 05:58:55 don Exp $ use warnings; use strict; use Getopt::Long; use Pod::Usage; use POSIX qw(strftime); =head1 NAME deletemailbox -- deletes a mailbox and the offlineimap information corresponding to that mailbox =head1 SYNOPSIS ss [options] mailbox Options: --account, -a account (Default lists) --debug, -d debugging level (Default 0) --help, -h display this help --man, -m display manual =head1 OPTIONS =over =item B<--account, -a> Name of the account from which the folder will be deleted =item B<--debug, -d> Debug verbosity. (Default 0) =item B<--help, -h> Display brief useage information. =item B<--man, -m> Display this manual. =back =head1 EXAMPLES deletemailbox -a lists rnm-devel =cut use User; use vars qw($DEBUG); # XXX parse config file my %options = (debug => 0, help => 0, man => 0, offlineimap => User->Home.'/.offlineimap', maildir => User->Home.'/Mail', account => 'lists', ); GetOptions(\%options,'account|a=s','debug|d+','help|h|?','man|m'); pod2usage() if $options{help}; pod2usage({verbose=>2}) if $options{man}; $DEBUG = $options{debug}; for my $mbox (@ARGV) { # Delete ~/.offlineimap/Repository-{Local,Remote}Lists/FolderValidity/mbox # initialcaps account needed for the account name my @cmd = ('rm','-f',qq($options{offlineimap}/Repository-Local). ucfirst($options{account}). qq(/FolderValidity/$mbox)); print join(' ',@cmd); system @cmd; @cmd = ('rm','-f',qq($options{offlineimap}/Repository-Remote). ucfirst($options{account}). qq(/FolderValidity/$options{account}.$mbox)); print join(' ',@cmd); system @cmd; # Delete ~/.offlineimap/Account-Lists/mbox @cmd = ('rm','-fr',qq($options{offlineimap}/Account-).ucfirst($options{account}). qq(/LocalStatus/$mbox)); print join(' ',@cmd); system @cmd; # Delete ~/Mail/mbox @cmd = ('rm','-fr',qq($options{maildir}/$options{account}/$mbox)); print join(' ',@cmd); system @cmd; } __END__