There is a useful tool called doveadm that will allow you to perform various administrative tasks with messages.
The following command is an example you can use to delete messages from specific folders that are older:
doveadm expunge -A mailbox Trash savedbefore 62d
Article ID: 293, Created: 4/29/2025 at 1:06 PM, Modified: 4/29/2025 at 1:06 PM