I have a server with several email accounts and limited space.
I set up a cron job to delete emails that are older than 5 days, using this:
find /home/domain/mail/ -type f -name "*vps.domain*" -mtime +5 -delete
It works really well, but cPanel keeps informing wrong account sizes. This is because there's a file in each folder called maildirsize
which keeps track of the dir size.
If I delete the file, cPanel says that the size is 0 bytes which is also wrong. The account seems to work OK though and the file is regenerated then.
Is there a way to regenerate these files after running that cron job? Deleting them all and wait for them to be re-generated when the account is used should in theory work, but all accounts will report being 0 bytes and I don't like that.