procmail
[Top] [All Lists]

Re: How to use Procmail to remove messages from server after x number of days

2011-03-01 16:45:25
On Tue, Mar 01, 2011 at 04:35:59PM -0500, Richard Ball wrote:
On 1-3-2011 16:31, LuKreme wrote:
-exec rm {} \; is simply a long way of spawning a shell and executing rm for 
old, OLD versions of find that don't have -delete.


Which will break if too many files are found. (where "too many" means the length of the string of filenames exceeds the buffer length allocated for commands on the system).

I think you're thinking of "rm `find ... `". According to my experience and the documentation of the POSIX behavior of "find" (http://pubs.opengroup.org/onlinepubs/009695399/utilities/find.html), "find ... -exec rm {} \;" should run rm once for each pathname, and thus should never exceed the buffer length.

I'm glad I looked that up, because now I know about "find ... -exec rm {}+". It avoids the heavyweight one-process-per-file of "-exec rm {} \;", batching them in sets, but limits the number of pathnames in each set specifically to avoid exceeding the buffer limit.

And since there's no intervening pipeline (unlike "find ... -print | xargs rm"), pathnames with spaces and newlines don't cause problems.

--
Ed Blackman

Attachment: signature.txt
Description: Digital signature

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