Greetings all... Can we delete maildir files directly from the file system? Basically, we use dovecot to train spam, and we want to delete messages that are older than 30 days, using a simple "find /maildirs -cname +30 -name *imap-server* -exec rm {} \;" I have seen a post a while ago saying that dovecot can rebuild the indexes, but I don't remember if it's when the index is deleted or when the maildir files are deleted. And if we cannot delete files with the 'rm' command, whats the best/proper way to delete these older files. Thanks
On 16.7.2007, at 19.33, Tom Bombadil wrote:> Can we delete maildir files directly from the file system?Yes. -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 186 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20070716/9b23c737/attachment-0002.bin>
Tom Bombadil wrote:> Greetings all... > > Can we delete maildir files directly from the file system? > > Basically, we use dovecot to train spam, and we want to delete messages > that are older than 30 days, using a simple "find /maildirs -cname +30 > -name *imap-server* -exec rm {} \;" > > I have seen a post a while ago saying that dovecot can rebuild the > indexes, but I don't remember if it's when the index is deleted or when > the maildir files are deleted. > > And if we cannot delete files with the 'rm' command, whats the > best/proper way to delete these older files. > > Thanks >My opinion has always been that the data structure should not be replied upon.... if you want to do things with your mail items, then use the APIs/imap commands to do it. That protects you from any internal stuff you didn't know about, or changed from one server to another, or one version to another. For example, I have the beginnings of a script to handle my "mail retention policies". It connects to Dovecot/imap to get the list of mail for specific folders, then uses the imap delete (or copy) API to delete mail older than n days, or to keep only the most recent n messages. That sort of thing. The benefit is my script then doesn't care how Dovecot (or whichever server) stores things.... and if a mailbox changes from mbox to maildir format, or similar change.. no worries... my script just doesn't care... it always uses the APIs to manipulate mail. Safe, but admittedly not as fast. I favor reliability over speed in these sorts of cases. :-)
>> Can we delete maildir files directly from the file system?> Yes.Does this also go for special folders inside a maildir? Like, for example, the .Trash folder? I have a user who was trying to delete about 30,000 messages from a folder, and when he did this, TBird went into never-never land, and now every time he clicks on the Trash folder in TBird, it goes into never-never land again. I have already deleted the local cache files from his TBird profile, so there is something wrong on the server side. I don't have much experience manually manipulating maildirs, so would appreciate comments... What I was going to do was first delete the folder: rm -ri /var/virtual/domain.com/maildir/.Trash then once it is all gone, do: maildirmake -f Trash /var/virtual/domain.com/maildir By the way, if it matters, this server is still running Courier I'm sorry to say, but I think they're ready to let me migrate them to dovecot now that it has reached 'stable' status. -- Best regards, Charles