Sometimes you may have a mailbox on a linux server with several thousand items in it that you wish to clear quickly. You can do this by following the following steps.
- Login to putty (https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html).
- Change directory to the folder you wish to empty in the following format: /home/[cpanel username]/mail/[domain.com - the part after the @ in the email]/[user - the part before the @ in the email]/[folder]/
If you wish to clear the inbox, this is listed as "cur". Unread mail can be found in "new".
e.g. for bob@example.com:
cd /home/example/mail/example.com/bob/cur/ - find . -type f -delete
If you want to change to a directory and then see what folders are available, "cd" changes directory, "ls" lists the contents, for example:
cd /home/example/mail/example.com/
ls
This would list the available users @example.com.
cd /home/example/mail/example.com/bob/
ls
This would list Bob's available folders.
WARNING: linux command line has the ability to delete/break everything very quickly, especially if you login as root.
Comments