procmail
[Top] [All Lists]

Re: error report from recipe [SOLVED]

2007-08-23 15:12:56
* Dallman Ross <dman(_at_)nomotek(_dot_)com> [08-23-07 17:57]:
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


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. :-)

openSUSE 10.1 x86_64

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.

no, it works correctly and keeps the *latest* 6000, about three weeks.

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

no

   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.

I have 'ls' from coreutils-5.93-20.jen1

I have found the solution....  I opened the backup directory and found
38,000 (thats merican, 38.000 for the rest of the world) files.
Recipe must have failed sometime last April .....  After deleting the
excess, the recipe performs as desired, retaining the latest 6000
emails.

This backup (if you will) configuration saves me time.  I sort into
list groups and delete all but interesting threads and/or specific
topics of interest as I am sure a lot of people do.  And I am remiss
at deleting OLD mail....

I employe mairix for mdir to search for particular postings/threads
when they become of interest.  Sometime for a recent posting which I
have deleted.  This "window" I maintain saves me searching online for
95% subject matter.

Sean was correct, ls generated an excessively long list that the cl
would not handle.  But it appears that 6000 is not that number and I
am safe for now.

thanks for your suggestions.

-- 
Patrick Shanahan         Plainfield, Indiana, USA        HOG # US1244711
http://wahoo.no-ip.org     Photo Album:  http://wahoo.no-ip.org/gallery2
Registered Linux User #207535                    @ http://counter.li.org
____________________________________________________________
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