procmail
[Top] [All Lists]

Re: error report from recipe

2007-08-23 15:18:07
On Thu, Aug 23, 2007 at 11:53:51PM +0200, Dallman Ross wrote:

On Thu, Aug 23, 2007 at 03:40:54PM -0400, Patrick Shanahan wrote:


The following recipe generates an error I do not know how to deal with..

# -------------------------------------------------------
:0 c
$MAILDIR/backup
:0 ic
| cd ~/mail/backup && rm -f dummy `ls -t msg.* | sed -e 1,6000d`
-------------------------------------------------------

Btw, don't you want the -r switch to ls there?  "ls -t" keeps
the newest on top.  If you delete 6000 from line 1, you'll delete
the newest, not the oldest.

Never mind, I see my mistake.  You are deleting the newest 6000 files
from the list of files, then deleting the rest.  Okay.

Another way:

 rm -f dummy `find ~/mail/backup -maxdepth 1 -type f -name 'msg.*' |\
            xargs -0 ls -t | tail +6001`

Or put it in a script and have procmail call the script.
____________________________________________________________
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