Date: Tue, 15 Jul 2008 23:01:03 -0800 From: Beech Rintoul <beech@freebsd.org> To: freebsd-questions@freebsd.org Subject: Re: why is this script failing? Message-ID: <200807152301.06856.beech@freebsd.org> In-Reply-To: <1216189379.81342.23.camel@predator-ii.buffyverse> References: <20080714201241.GA22443@thought.org> <20080716114210.59372334@ayiin> <1216189379.81342.23.camel@predator-ii.buffyverse>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 15 July 2008, Wayne Sierke said: > 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. > > And for things like those pesky .SVN dirs in a port: find /usr/ports/foo/work -depth -type d -name .SVN -exec rm -rf {} \; Beech -- --------------------------------------------------------------------------------------- Beech Rintoul - FreeBSD Developer - beech@FreeBSD.org /"\ ASCII Ribbon Campaign | FreeBSD Since 4.x \ / - NO HTML/RTF in e-mail | http://www.freebsd.org X - NO Word docs in e-mail | Latest Release: / \ - http://www.FreeBSD.org/releases/7.0R/announce.html ---------------------------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807152301.06856.beech>