Created
June 4, 2025 11:24
-
-
Save DartPower/557ae65c581538e927eea1a958f022b0 to your computer and use it in GitHub Desktop.
Скрипт для чистки всех писем от начала времен до определенной даты Dovecot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doveadm expunge -A mailbox '*' savedbefore 2024-01-01 | |
TOUCH_TS=$(date -d "2023-12-31 23:59:59" +%Y%m%d%H%M.%S) | |
touch -t $TOUCH_TS /tmp/timestamp_ref | |
cd /var/www/www-root/data/email/company.name | |
find . -type f -path "*/.maildir/*" \( -name "*,*" -o -name "*,*:2,*" \) ! -newer /tmp/timestamp_ref -delete | |
find . -name "dovecot.index*" -exec rm {} \; | |
doveadm force-resync -A '*' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment