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

Ed Blackman <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
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

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
[email protected]
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
signature.txt (application/pgp-signature, 190 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iD8DBQFNbXb13nrUNJhVPs4RAo2EAJ4nqR8iC1pvIvjRG3KHi3FIwzbXfACeOCEu
PbWtTQUj2kxHallO+o9Go7o=
=aODy
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.