How \Deleted flag can be unset for all mails in cyrus-imapd mailbox?

Posted by Sachin Divekar on Server Fault See other posts from Server Fault or by Sachin Divekar
Published on 2012-04-09T02:28:35Z Indexed on 2012/04/09 5:32 UTC
Read the original article Hit count: 556

Filed under:
|
|
|

I have a 5GB mailbox which I moved using imapsync. But somehow I messed up with --delete/--delete2 option and end up with almost all the messages having \Deleted flag set. I do not have delayed expunge enabled, so I can not use unexpunge utility. I am using cyrus-imapd v2.3.7. Using cyrus-imapd's debugging feature I found out that email client(Roundcube in my case) fires following IMAP command to unset it.

UID STORE 179 -FLAGS.SILENT (\Deleted)

I don't know if somehow I can fire this command for all the mails.

Is there any way I can unset \Deleted flag for all the mails in the mailbox?

UPDATE:

Using @geekosaur's tip of specifying range of message-ids in the above command, I could solve it for one mailbox under INBOX like INBOX.folder1. Is there any way I can do it for multiple mailboxes under INBOX recursively? Now I am working on solving it using/creating some script, maybe using Perl's IMAP related module. But still I need to solve it asap so inputs are welcome.

© Server Fault or respective owner

Related posts about email

Related posts about emailserver