LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 10: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, 11:41 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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, 12: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, 12:22 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well why aren't you just using a real mail client?? jsut delete it the normal way
 
Old 09-10-2002, 02: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 02:36 PM.
 
Old 09-10-2002, 02: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 02:37 PM.
 
Old 09-10-2002, 03:51 PM   #7
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
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 03:53 PM.
 
Old 09-10-2002, 03:53 PM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

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

Rep: Reputation: 69
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



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 05:15 AM
Deleting mail on the server joji_in_changwon Programming 3 06-15-2005 07:00 PM
kmail deleting mail msmithson Linux - General 1 03-10-2005 10:32 AM
Evolution not deleting POP3 server mail when Getting mail. dummy.1 Linux - Newbie 3 07-13-2004 07:50 AM
Exists a mail-client for Fedora, that can read local mail file without deleting? mxn Linux - Software 1 07-10-2004 12:53 PM

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

All times are GMT -5. The time now is 08:07 AM.

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
Open Source Consulting | Domain Registration