Tags

, , , , ,

User always forget to empty there trash folder. User delete mail from there inbox; but don’t delete those mail from Trash folder. At the end, it eats up a lot of your server disk space. Empty this Trash folder is big headache for the administrator. Shell script can easily rescue the administrator. First create a list for you user. You can create it easily from awk commad. Save it in a file named user. Now create a new bassh file named trash_empty.sh and chown it to 755. Add the following syntex to the trash_empty.sh file

#!/bin/sh
for i in `more user`
do
echo $i
cat /dev/null > $i/mail/Trash
done

[user Trash folder in /home/username/mail/Trash. It may varies depending on your mail server configuration. ]

Now run the file trash_empty.sh WOW all your users Trash folder will be empty 🙂

Please take your own responsibility to empty users trash folder 🙂