Re: [Evolution] Deleting duplicate emails



On Thu, 2003-08-21 at 05:08, HvR wrote:
run md5sum on the mail message body and store the resulting string in
a file then compare each message against this list in the file, if the
md5sums of the message body are the same then the message is
guaranteed to be the same.

Ok, here is my script (I am begining in perl so excuse if 
it is not good code) :

#!/usr/bin/perl

use strict;

my $line = "";
my $temp_file = '/.../email_temp';
my $list_file = '/.../email_list';

my @mail = <STDIN>;
open TEMP, ">$temp_file";
print TEMP @mail;
close TEMP;

my $current_md5 = `md5sum "$temp_file" | cut -f1 -d ' '`;

open FILE, "$list_file";
my @list = <FILE>;
close FILE;

foreach $line (@list) {
  if ($current_md5 eq $line) {
    exit 0;
  }
}

open FILE, ">>$list_file";
print FILE $current_md5;
close FILE;
exit 1;


That does the trick but, I would like it to be applied only "on demand"
and not have to "disable" it each time I receive mails... Is there a way
to do that ?




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]