copying and renaming mailboxes to clean up directories

Thorsten Büker mailinglists at bueker.net
Mon May 28 08:43:46 EDT 2007


Dear Bron, dear Andrew,

well, I left the ugly problem unsolved for a couple of weeks ;-)

> I think I've posted my "Cyrus::IndexFile" perl module to the list
> before, but I'll attach it here as well.  This allows you to parse
> through indexes a lot more efficiently, and 'cyr_dbtool' (see the
> patches at http://cyrus.brong.fastmail.fm/) is great for seeing the
> contents of mailboxes.db.  Unfortunately, most of our tools are only
> for cyrus 2.3+.  We were running a fairly recent CVS even back when I
> started work on dbtool, and that was one of my first projects at
> FastMail.
> 
> I've had to do the same job, and I did it by reading the directory
> contents and listing UIDs via IMAP, then removing any that didn't
> match.  There's no need to move anything.
> 
> $imap->select("INBOX.Trash");
> ls /var/spool/imap/b/user/brong/Trash/
> 
> You'll need some logic to map from mailbox names to on-disk paths of
> course, but I think this is a cleaner solution than the copying one, and
> as other people have noted, this doesn't break flags (including \Sent)

At http://www.bueker.net/cyrus/remove_old_uids.pl the script I've 
finally used is available. It's based on Andrew's copy_user_mailbox.pl. 
Sorry for my rather poor programming skills -- but as far as I can see 
it works fine ;-)

Thanks again for your help!

kind regards,
   Thorsten


More information about the Info-cyrus mailing list