From owner-freebsd-questions@FreeBSD.ORG Sun Jan 29 12:35:53 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1883F16A426 for ; Sun, 29 Jan 2006 12:35:53 +0000 (GMT) (envelope-from list-freebsd-2004@morbius.sent.com) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA58843D45 for ; Sun, 29 Jan 2006 12:35:52 +0000 (GMT) (envelope-from list-freebsd-2004@morbius.sent.com) Received: from frontend1.internal (mysql-sessions.internal [10.202.2.149]) by frontend1.messagingengine.com (Postfix) with ESMTP id 6FAE4D3360B for ; Sun, 29 Jan 2006 07:35:51 -0500 (EST) Received: from frontend2.messagingengine.com ([10.202.2.151]) by frontend1.internal (MEProxy); Sun, 29 Jan 2006 07:35:51 -0500 X-Sasl-enc: vGirncWc04F5FtkM0CKO8C1w0Out7KsVey+YsezdSaVr 1138538150 Received: from gumby.localdomain (88-104-192-207.dynamic.dsl.as9105.com [88.104.192.207]) by frontend2.messagingengine.com (Postfix) with ESMTP id A99BA5714A2 for ; Sun, 29 Jan 2006 07:35:50 -0500 (EST) From: RW To: freebsd-questions@freebsd.org Date: Sun, 29 Jan 2006 12:35:46 +0000 User-Agent: KMail/1.9.1 References: <927ad6550601271534r17a6ddb2jd90b930f744d170f@mail.gmail.com> <200601281733.47099.kirk@strauser.com> <20060129032722.GB85318@alexis.mi.celestial.com> In-Reply-To: <20060129032722.GB85318@alexis.mi.celestial.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200601291235.47999.list-freebsd-2004@morbius.sent.com> Subject: Re: rm - Argument list too long X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2006 12:35:53 -0000 On Sunday 29 January 2006 03:27, Bill Campbell wrote: > On Sat, Jan 28, 2006, Kirk Strauser wrote: > >On Friday 27 January 2006 17:52, Paul Schmehl wrote: > >> for files in *.* > >> do > >> rm $files > >> done > > > >Don't ever, *EVER* blindly unlink glob expansions. It's bad for you. > > > >Instead, use something like: > > > > find . -name 'sess.*' -delete > > While that's good advice, it doesn't answer the question of argument list > too long. Yes, it does. The glob is expanded by find, the "argument list too long" problem occurs when the glob is expanded by the shell. > The short answer is read ``man xargs''. > > find . | xargs command That should be: find . -print0 | xargs -0 command In FreeBSD null termination is needed to handle names with spaces, and not just the rare problem of names containing newlines. It's easier to just use find with the ls, delete and exec[dir] options.