• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

delete all mails from multiple mailboxes

I have 100 mailboxes with many mails. I want to delete all mails from all accounts.

is there any command for this
0
ashishn
Asked:
ashishn
  • 2
1 Solution
 
jlevieCommented:
'rm /var/spool/mail/*' will delete all of the inboxes on the system. If you don't actaully want to delete everyting you  can deleted the files in /var/spool/mail that belong to user's whose mailboxes are to be emptied.
0
 
neostudioCommented:
try this...........
PS>> PSEUDO CODE [NOT TESTED]



touch /sbin/cleanmail.sh
vi /sbin/cleanmail.sh

====================
!#/bin/sh
rm /var/spool/mail/*
echo "Mailboxes Cleaned, Asta La Vista !"
exit 0

chmod 755 /sbin/cleanmail.sh
=====================

you can also set to run in on each reboot for example, or do not use it at all...


regards,
</Ruslan>
0
 
neostudioCommented:
just interested,
why did you grade this answer as a B ??
it is 100% an A answer, isn't it ??

0
 
ashishnAuthor Commented:
b'se I was looking for a solution to delete all mails in all 100 accounts using single command.

I found the solution as

cd /var/spool/mail
for i in mobi*; do 'cat /dev/null > $i; done

0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now