Solved

delete all mails from multiple mailboxes

Posted on 2002-03-26
4
210 Views
Last Modified: 2010-04-20
I have 100 mailboxes with many mails. I want to delete all mails from all accounts.

is there any command for this
0
Comment
Question by:ashishn
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 50 total points
ID: 6896405
'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
 
LVL 3

Expert Comment

by:neostudio
ID: 6898174
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
 
LVL 3

Expert Comment

by:neostudio
ID: 6899518
just interested,
why did you grade this answer as a B ??
it is 100% an A answer, isn't it ??

0
 

Author Comment

by:ashishn
ID: 6901610
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now