LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-10-2002, 11:57 AM   #1
tied2
Member
 
Registered: Jun 2002
Location: Florida
Distribution: Redhat, FreeBSD, FC 6
Posts: 220

Rep: Reputation: 30
Question Deleting Mail


I want to delete all my mail from var/spool/mail/root I'm using vi to veiw it .....

Would I just cd /var/spool/mail
then rm -r root will that delete the directory also? I just want to empty the file or at least some of it.


Thanks.
 
Old 09-10-2002, 12:41 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
no, it is a file, not a directory, the -r switch if you read the manpage) is for recursive deletion, which doesn't make sense on a single file. it'll work, but it's quite pointless. but just deleting that file will get rid of it yes. i don't think you need to have the file to recieve mail into it, but to be sure you should "touch" it again after you have deleted it
 
Old 09-10-2002, 01:04 PM   #3
tied2
Member
 
Registered: Jun 2002
Location: Florida
Distribution: Redhat, FreeBSD, FC 6
Posts: 220

Original Poster
Rep: Reputation: 30
Thanks, I removed it then checked it ...it wasn't there so I "touch" it and now it says that it's there.........so that means after I clean my mail from there I won't need to "touch" it every time right.
 
Old 09-10-2002, 01:22 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
well why aren't you just using a real mail client?? jsut delete it the normal way
 
Old 09-10-2002, 03:32 PM   #5
tied2
Member
 
Registered: Jun 2002
Location: Florida
Distribution: Redhat, FreeBSD, FC 6
Posts: 220

Original Poster
Rep: Reputation: 30
I have my reasons.

Last edited by tied2; 09-10-2002 at 03:36 PM.
 
Old 09-10-2002, 03:35 PM   #6
tied2
Member
 
Registered: Jun 2002
Location: Florida
Distribution: Redhat, FreeBSD, FC 6
Posts: 220

Original Poster
Rep: Reputation: 30
thanks for your help.

Last edited by tied2; 09-10-2002 at 03:37 PM.
 
Old 09-10-2002, 04:51 PM   #7
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 68
Well if you are cleaning your mail that way each time, then touching the file shouldn't be too bad, you might already be in the directory so:
touch filename
would do it. Not bad after doing
rm filename
Not bad at all.

You could write a very simple script to do this for, and then just run it when you are ready to rm the file, and touch the new one. Here's a REALLY bad example, as I know little to nothing about scripting:
Code:
#!/bin/bash
#This is to delete my mail
rm -r /var/spool/mail/root &&
touch /var/spool/mail/root
#Now I am ready for more mail
Save the file, and then:
chmod 755 /path/to/file/deletemail.sh
Now to run it:
./deletemail.sh
You might not even need the && in there.

Cool

Last edited by MasterC; 09-10-2002 at 04:53 PM.
 
Old 09-10-2002, 04:53 PM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
MasterC, i'd suggest reading up a bit on bash...
 
Old 09-10-2002, 05:17 PM   #9
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 68
he he he, yeah, it's just a bad example, but gives an idea of something to do. Thanks for the suggestion though Acid
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
deleting mail with spamassassin msound Linux - Software 4 09-13-2014 06:15 AM
Deleting mail on the server joji_in_changwon Programming 3 06-15-2005 08:00 PM
kmail deleting mail msmithson Linux - General 1 03-10-2005 11:32 AM
Evolution not deleting POP3 server mail when Getting mail. dummy.1 Linux - Newbie 3 07-13-2004 08:50 AM
Exists a mail-client for Fedora, that can read local mail file without deleting? mxn Linux - Software 1 07-10-2004 01:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration