Posted By: Tuttle (MamPoLetechJinyUsername!) on 'CZunix'
Title:     Re: duplikatni maily v Maildiru
Date:      Fri Aug 25 10:06:41 2006

> Nejlepsi by tipuju bylo zkusit to na zaklade msg-id, coz se samozrejme da 
> napsat, ale neudelal to uz nekdo jiny? ;)

For Jimo:

$ /usr/local/bin/msgid -h

/usr/local/bin/msgid  --  Quiiick Message-Id resolver for Maildirs

  Version 0.1   (c) Jun 6 2005 Vlada Macek <tuttle@bbs.cvut.cz>

  We expect the set of e-mail message filenames on standard input and return
  the Message-Id header value for that file. Only the header lines are read.
  In case the number of Message-Id headers in the message differs from 1, it
  is reported on stderr as warning.

  Example:

   find <slozka> -type f -regex '.*/(cur|new|tmp)/.*' | msgid > ~/msgids

For !Jimo:

  Zdrojak je zde http://sandbox.cz/~tuttle/bits/.

Dale napriklad:

cd

sort +1 msgids | uniq --skip-fields=1 --repeated > msgids-repeated

sort +1 msgids | uniq --skip-fields=1 --all-repeated=separate 
   > msgids-all-repeated 

fgrep --line-regexp --invert-match --file=msgids-repeated msgids-all-repeated 
   | cut --fields=1 > msgids-to-delete

V msgids-to-delete mas seznam souboru na smazani (2 az posledni z kazde 
skupinky mailu se stejnym Message-Id). Na Message-Id bych se ale zcela 
nespolehal. Jeste bych pred mazanim zkontroloval, jestli maji soubory 
uvedene v souboru msgids-all-repeated stejny obsah.

To napriklad jejich automatickym presunem do vedlejsiho adresare a pouzitim 
funkce mc "Quick View".

Presun:

   mkdir --parents ~/tmp/kontrola
   cat msgids-all-repeated | xargs mv --target-directory=~/tmp/kontrola

Mazani:

   cat msgids-to-delete | xargs rm --verbose

Hope it helps. Unix is mmmmighty. :-)

T.

Search the boards