From owner-freebsd-questions@FreeBSD.ORG Wed Jul 16 14:39:00 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 641AF106567F for ; Wed, 16 Jul 2008 14:39:00 +0000 (UTC) (envelope-from ws@au.dyndns.ws) Received: from ipmail05.adl2.internode.on.net (ipmail05.adl2.internode.on.net [203.16.214.145]) by mx1.freebsd.org (Postfix) with ESMTP id E32F48FC15 for ; Wed, 16 Jul 2008 14:38:59 +0000 (UTC) (envelope-from ws@au.dyndns.ws) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtoAAKikfUiWZWdv/2dsb2JhbAAIsGw X-IronPort-AV: E=Sophos;i="4.30,373,1212330600"; d="scan'208";a="161292610" Received: from ppp103-111.static.internode.on.net (HELO [192.168.1.157]) ([150.101.103.111]) by ipmail05.adl2.internode.on.net with ESMTP; 17 Jul 2008 00:08:58 +0930 From: Wayne Sierke To: freebsd-questions In-Reply-To: <20080716150107.771de073@gumby.homeunix.com.> 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> <20080716150107.771de073@gumby.homeunix.com.> Content-Type: text/plain Date: Thu, 17 Jul 2008 00:08:56 +0930 Message-Id: <1216219136.81342.31.camel@predator-ii.buffyverse> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port 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:39:00 -0000 On Wed, 2008-07-16 at 15:01 +0100, RW wrote: > 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. Except that the -delete primary of find is not the equivalent of rm -vf, or even of just rm -f.