Removed useless outer loop; Corrected close()'s; Fixed Emacs compile
command
This commit is contained in:
parent
6fbe116841
commit
509be144a2
1 changed files with 31 additions and 33 deletions
|
@ -32,13 +32,13 @@ my($MAILDIR_FOLDER, $DSPAM_PROB_MIN, $DSPAM_CONF_MIN) = @ARGV;
|
||||||
|
|
||||||
my($total, $countDeleted) = (0, 0);
|
my($total, $countDeleted) = (0, 0);
|
||||||
|
|
||||||
foreach my $folder (@dupFolders) {
|
my @msgDirs = ("$MAILDIR_FOLDER/cur", "$MAILDIR_FOLDER/new");
|
||||||
my @msgDirs = ("$folder/cur", "$folder/new");
|
|
||||||
foreach my $dir (@msgDirs) {
|
foreach my $dir (@msgDirs) {
|
||||||
die "$MAILDIR_FOLDER must not be a maildir folder (or is unreadable by you), since $dir isn't a readable directory: $!"
|
die "$MAILDIR_FOLDER must not be a maildir folder (or is unreadable by you), since $dir isn't a readable directory: $!"
|
||||||
unless (-d $dir);
|
unless (-d $dir);
|
||||||
}
|
}
|
||||||
foreach my $dir (@msgDirs) {
|
foreach my $dir (@msgDirs) {
|
||||||
opendir(MAILDIR, $dir) or die "Unable to open directory $dir for reading: $!";
|
opendir(MAILDIR, $dir) or die "Unable to open directory $dir for reading: $!";
|
||||||
while (my $file = readdir MAILDIR) {
|
while (my $file = readdir MAILDIR) {
|
||||||
next if -d $file; # skip directories
|
next if -d $file; # skip directories
|
||||||
|
@ -63,14 +63,12 @@ foreach my $folder (@dupFolders) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$total++;
|
$total++;
|
||||||
|
|
||||||
if ($dspamVal{Confidence} >= $DSPAM_PROB_MIN and
|
if ($dspamVal{Confidence} >= $DSPAM_PROB_MIN and
|
||||||
$dspamVal{Probability} >= $DSPAM_CONF_MIN) {
|
$dspamVal{Probability} >= $DSPAM_CONF_MIN) {
|
||||||
$countDeleted++;
|
$countDeleted++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
close MAIL_MESSAGE;
|
close MAIL_MESSAGE;
|
||||||
}
|
}
|
||||||
close MAILDIR;
|
close MAILDIR;
|
||||||
|
@ -81,5 +79,5 @@ print "$countDeleted of $total would be deleted\n";
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Local variables:
|
# Local variables:
|
||||||
# compile-command: "perl -c remove-dup-mails-from-maildir.plx"
|
# compile-command: "perl -c remove-spam-high-confidence-maildir.plx"
|
||||||
# End:
|
# End:
|
||||||
|
|
Loading…
Add table
Reference in a new issue