procmail
[Top] [All Lists]

Re: expiring SPAM in Maildirs?

2008-07-29 12:18:22
In message <1818FA22-4B9A-4571-9270-C9DC45376996(_at_)kreme(_dot_)com>,
        LuKreme (kremels(_at_)kreme(_dot_)com) wrote:
On 28-Jul-2008, at 20:00, Michael J Wise wrote:
[...]
That, plus a `find` in front of it ... Unlimited Power!

Well, since we've strayed a tad off-topic indulge me for a minute...

how would you do a find for all the files older than a given file?

find /path/to/search -type f ! -mnewer /path/to/reference/file
 
For example, (dragging this somewhat back on topic) let's say we want  
to look at the date of the cur/ folder inside a maildir and expire all  
the spam that is older that that date + 30 days?

(effectively, this would expire spam that was 30 days from the last  
login)

we have:

find /path/to/.SPAM/ -type f -ctime +30 -exec rm {} \;

to expire the spam that is 30 days old

something like

find /path/to/.SPAM -type f -newercc +30 /path/to/cur -ls

but -newerXY doesn't appear to take a modifier like +30

Perhaps a bit OTT, but how about something like:

ref_date=$(date -v-30d -jf '%s' `stat -f %m /path/to/reference/file` '+%s')
ref_date=$((ref_date / 86400))
find /path/to/search -type f -mtime ${ref_date}d

:-)


Cheers,
       Nick.
-- 

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>