Delete all mail users data


Please I would like to delete all users date mail (not accounts) in my virtualmin box.

I using Centos 5 and the default install (default install script).

Once I erased simply the files in the maildir folders and broke the dovecot setup (dovecot cache).

Which is the correct way of doing it?

Thanks in advance.


Also delete the dovecot cache/index files. :wink:

Dovecot will regenerate its cache files automatically on next login by the user.

Thanks for your help, I delete the mail data using:

find /home -type f -mtime $days | xargs rm

This would remove everything over $days days old.

That’s remove the dovecot files also.


Careful with that command – that won’t just delete email, that will delete all user files in /home older than $days.

You may want to have it be more specific about what directories to delete email from – for example, all the email exists in a directory called “Maildir”, you could make sure you’re only deleting files from within that.