From owner-freebsd-questions@FreeBSD.ORG Wed Jul 16 14:12:42 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BAE810656CC for ; Wed, 16 Jul 2008 14:12:42 +0000 (UTC) (envelope-from fbsd06+X4=d5d0fb9e@mlists.homeunix.com) Received: from fallback-in1.mxes.net (fallback-out1.mxes.net [216.86.168.190]) by mx1.freebsd.org (Postfix) with ESMTP id 436C58FC2E for ; Wed, 16 Jul 2008 14:12:42 +0000 (UTC) (envelope-from fbsd06+X4=d5d0fb9e@mlists.homeunix.com) Received: from mxout-03.mxes.net (mxout-03.mxes.net [216.86.168.178]) by fallback-in1.mxes.net (Postfix) with ESMTP id 8A6C1164682 for ; Wed, 16 Jul 2008 10:01:12 -0400 (EDT) Received: from gumby.homeunix.com. (unknown [87.81.140.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id B5A8423E498 for ; Wed, 16 Jul 2008 10:01:10 -0400 (EDT) Date: Wed, 16 Jul 2008 15:01:07 +0100 From: RW To: freebsd-questions@freebsd.org Message-ID: <20080716150107.771de073@gumby.homeunix.com.> In-Reply-To: <1216189379.81342.23.camel@predator-ii.buffyverse> References: <20080714201241.GA22443@thought.org> <20080715073651.P1638@wojtek.tensor.gdynia.pl> <20080715183500.GA76088@thought.org> <20080715190224.GC21840@Grumpy.DynDNS.org> <20080715215024.GA82902@thought.org> <20080716114210.59372334@ayiin> <1216189379.81342.23.camel@predator-ii.buffyverse> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: why is this script failing? 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: Wed, 16 Jul 2008 14:12:42 -0000 On Wed, 16 Jul 2008 15:52:59 +0930 Wayne Sierke wrote: > On Wed, 2008-07-16 at 11:42 +1000, Norberto Meijome wrote: > > you can always do > > > > find /tmp/kde-*/ -iname "*wav" -print0 | xargs -0 rm -vf > > > > the advantage over doing using rm * or for * in ... is that if you > > have LOTS of files, the expanded list of files may be too much. > > find | xargs will deal with each file in turn. ( -print0 and -0 is > > to use NULL char as a list delimiter instead of space... ). > > > Note that - as highlighted in previous discussions on the fbsd lists > re the use of xargs with find - find is eminently capable of handling > large argument lists and filenames_with_spaces with its own -exec > primary: > > find /tmp/kde-*/ -iname "*wav" -exec rm -vf {} \; > > to exec rm for each file individually, or: > > find /tmp/kde-*/ -iname "*wav" -exec rm -vf {} \+ > > to exec rm for multiple files at once. > > Piping to xargs in this case is unnecessary. You don't even need exec, since find has a -delete option.