procmail
[Top] [All Lists]

Re: error report from recipe

2007-08-23 14:56:11
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`
-------------------------------------------------------

the error:

 Folder:  cd ~/mail/backup && rm -f dummy ls -t msg.* | sed -e 1,600
/bin/bash: /bin/ls: Argument list too long


Am I limited to three digits or is the error msg truncated.  I really
want to maintain an accumulation of ~6000 duplicate msgs.

What OS?  I can't duplicate it, but I only find fewer than 1000 messages
in the biggest dir I have access to on this system. :-)

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.

Are there files in there that don't start with "msg."?  If
not, you could try

   rm -f dummy `ls -tr | head -6000`

Or if that's no good, you could try:

    rm -f dummy `ls -tr msg.* | xargs -0 | head -6000`

Or if that's no good, you could use find.

   rm -f dummy `find ~/mail/backup -maxdepth 1 -type f -name 'msg.*' -mtime +7`

for older than 7 days.  Or if you really want exactly the number 6000,

   rm -f dummy `find ~/mail/backup -maxdepth 1 -type f -name 'msg.*' | ls -tr | 
head -6000`

Or you could always go and get and compile gnu-ls.

dman
____________________________________________________________
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