Solved

delete all mails from multiple mailboxes

Posted on 2002-03-26
4
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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