Sunday, December 14, 2008

Problem with refiltering a Mail directory

I decided to split my perldl messages from incoming directory
however when I foolishly decided to run

http://markmail.org/message/tz6isa4n4ubyssuc#query:rerun procmail on a maildir+page:1+mid:tukr7f524zmykz7n+state:results



#/usr/bin/sh
cd Mail/inbox/cur
for file in *; do
procmail < $file
done

this gave me multiple copies of the original mails
then if I ran this multiple times I had a mess with 30,000 mails in my inbox
instead of 4301
so I had to run this
script-dealwithdups.pl
#!/usr/bin/perl -w
use strict;
use File::Find::Duplicates;
my $in=shift;

my @dupes = find_duplicate_files("$in");
my $length;
foreach my $dupeset (@dupes) {
my $length= scalar @{$dupeset->files} ;
if ($length >= 1) {

for (my $i=0; $i<$length -1 ;$i++) {
#print $ { $dupeset->files} [$i]; print "\n";
unlink $ { $dupeset->files} [$i];
}
}
where I got File::Find::Duplicates from CPAN