On 06/27/2002, 19:06 +0300, Udi Mottelo wrote:
[...]
The trick here is that "%m%d" will make all the filenames in four
characters (zero leading if needed). It helps the ls(1) to give you
the list of files sorted by date (:-) Now, you need cut the HEAD of
the list not tail.
Yes, sorry, I missed the reversal order :-/
You right there is a problem if you get no
messages say, 30 days. in this case we will see:
yarkon# ls
0601
0602
0701
0702
...
If we remove the first 36 files we are going to remove files from
Jul too early - to avoid - you can touch the file from crontab at
night. You will get empty files for empty days.
No, it is not the main problem, but:
if your procmail code is executed on every message (or every message in
a nested block), then you will remove *36* (older) remaining
messages... when receiving *one*; it is not the same thing as keeping
the 36 last messages!
As you create a daily directory|folder, you need deleting it only once a
day... BTW, it doesn't solve the original question, but as I can receive
hundred(s) messages in one fetchmail session...
In your case when size or other parameters included, the find(1)
solution is much more efficient.
I hope it is safer[1], but "find .... -exec rm {} \;" is slower than
one "rm", as we can easily construct its arguments:
rm -f something`date -d '2 days ago' +%m%d`
# or "rm -rf"
if cron runs every night, of course...
BTW. I suppose that %y%m%d is better (happy new year..)
not useful here, maybe.
[1] that's also why I use a maildir/
--
Jacques L'helgoualc'h
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail