I have a question? Is it possible that with doveadm delete all but the last x-number of messages in a folder. For example to retain the last 200 messages in the folder. If it is possible, how do you do it? Something like "doveadm expunge -u jane.doe@example.org mailbox xxx"
Thank you!
//Tommy
doveadm search -u jane.doe@example.org mailbox INBOX | cut -d" " -f2 | head -n -200 | tr '\n' , | xargs -n1 doveadm expunge -u jane.doe@example.org mailbox INBOX uid
basically, get all uid's and use head to cut out all but the last 200, turn that into a comma separated list, and pass to dovadm expunge.
Test it first!
On 03/11/2014 03:02 PM, Tommy Berglund wrote:
I have a question? Is it possible that with doveadm delete all but the last x-number of messages in a folder. For example to retain the last 200 messages in the folder. If it is possible, how do you do it? Something like "doveadm expunge -u jane.doe@example.org mailbox xxx"
Thank you!
2014-03-11 20:41, Gedalya skrev:
doveadm search -u jane.doe@example.org mailbox INBOX | cut -d" " -f2 | head -n -200 | tr '\n' , | xargs -n1 doveadm expunge -u jane.doe@example.org mailbox INBOX uid
basically, get all uid's and use head to cut out all but the last 200, turn that into a comma separated list, and pass to dovadm expunge.
Test it first!
Thanks! I try to test in this weekend.
//Tommy
On 03/11/2014 03:02 PM, Tommy Berglund wrote:
I have a question? Is it possible that with doveadm delete all but the last x-number of messages in a folder. For example to retain the last 200 messages in the folder. If it is possible, how do you do it? Something like "doveadm expunge -u jane.doe@example.org mailbox xxx"
Thank you!
participants (2)
-
Gedalya
-
Tommy Berglund