LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 06-11-2003, 01:36 PM   #1
gquiring
LQ Newbie
 
Registered: May 2003
Location: Matawan, NJ
Distribution: Red Hat, Solaris
Posts: 20

Rep: Reputation: 0
Script to delete mail based on date


I am using SpamAssassign and moving spam to it's own file under/home/<user>/mail. I have setup SquirrelMail for users to examine their spam incase of a false positive.

I would like to purge the spam folder of older mails and only keep the most recent 30 days of spam for each user.

Are there any scripts to do this?
 
Old 06-13-2003, 04:56 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
If this is still an unresolved issue and you're not afraid to script a bit, have a look at procmail. In short if you have a date variable properly formatted and add "-d '1 month ago' you'll have the previous month, pipe the mailbox through the procmail recipe and let formail select by date, then grep for the previous month variable. I think that could work.
 
Old 06-13-2003, 05:17 PM   #3
gquiring
LQ Newbie
 
Registered: May 2003
Location: Matawan, NJ
Distribution: Red Hat, Solaris
Posts: 20

Original Poster
Rep: Reputation: 0
I found a great utility called grepmail. It does exactly what I need. I just pipe my Spam folder through it with a date argument to filter out the older spam.

http://grepmail.sourceforge.net/
 
Old 06-13-2003, 06:06 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Excellent trove!
 
Old 04-03-2011, 11:25 PM   #5
kpearsonxyz
LQ Newbie
 
Registered: Jan 2011
Location: Lehi, Utah
Distribution: Linux Mint
Posts: 15

Rep: Reputation: 1
Quote:
Originally Posted by gquiring View Post
I found a great utility called grepmail. It does exactly what I need. I just pipe my Spam folder through it with a date argument to filter out the older spam.

http://grepmail.sourceforge.net/
I just stumbled across this and wonder if it deletes the mail found from the source mbox file?

Thanks
 
Old 04-04-2011, 02:20 AM   #6
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
Dude, please don't drag up dead threads, it gets *very* confusing.
 
Old 05-08-2013, 08:09 AM   #7
bpolhemus
LQ Newbie
 
Registered: Aug 2012
Posts: 7

Rep: Reputation: Disabled
Why?

Quote:
Originally Posted by acid_kewpie View Post
Dude, please don't drag up dead threads, it gets *very* confusing.
The problem still exists. The tools still exist. I was so glad to find the information here and feel no confusion at all. Did you hate history in school or something?

---------- Post added 05-08-13 at 08:10 AM ----------

Quote:
Originally Posted by kpearsonxyz View Post
I just stumbled across this and wonder if it deletes the mail found from the source mbox file?

Thanks
Yes, if you so direct. It's very powerful.
 
Old 05-08-2013, 08:40 AM   #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
Oh how I love the strange games people like to play.
 
Old 05-08-2013, 09:24 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator Response

Quote:
Originally Posted by bpolhemus View Post
The problem still exists. The tools still exist. I was so glad to find the information here and feel no confusion at all. Did you hate history in school or something?

---------- Post added 05-08-13 at 08:10 AM ----------

Yes, if you so direct. It's very powerful.
As my fellow moderator has stated that resurrecting old (necro) threads can be confusing;

Quote:
1. Members that have participated in the thread may no longer be active or responsive.

2. As time goes by the conditions may change over time and have varied answers or solutions.
I will add that LQ Rules state;
Quote:
  • Do not post if you do not have anything constructive to say in the post.
  • When posting in an existing thread, ensure that what you're posting is on-topic and relevant to the thread. If the content of your post will interfere with the current discussion, you should start a new thread.
You clearly did not post anything constructive to the thread. Poor Netiquette & violation of LQ Rules.

I do suggest that you re-read LQ Rules and please read the following to hopefully help when you post to LQ ;
Quote:
FYI: How to Answer a Linux Question is ‘Simon Bridge's excellent composition to aid us in good informational exchanges.'

FYI: Netiquette is a set of social conventions that facilitate interaction over networks, ranging from Usenet and mailing lists to blogs and forums.

FYI: I suggest that you look at 'How to Ask Questions the Smart Way' so in the future your queries provide information that will aid us in diagnosis of the problem or query.
If you have any questions concerning this issue then please feel free to contact me.

This thread is now closed.
 
  


Closed Thread



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to remove old files based on date WindozBytes Linux - General 12 06-04-2012 01:21 AM
IMAP - delete after certain date paul_mat Linux - Networking 2 08-01-2005 03:31 PM
Delete files based on date stefaandk Linux - General 3 06-17-2005 02:20 AM
Script for deleting files based on date MaverickApollo Linux - General 3 02-03-2004 07:54 PM
Script to Delete Old Mbox Mail granatica Linux - Software 2 10-06-2003 10:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:01 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
Open Source Consulting | Domain Registration