why is this script failing?

Wayne Sierke ws at au.dyndns.ws
Wed Jul 16 14:39:00 UTC 2008


On Wed, 2008-07-16 at 15:01 +0100, RW wrote:
> On Wed, 16 Jul 2008 15:52:59 +0930
> Wayne Sierke <ws at au.dyndns.ws> 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.




More information about the freebsd-questions mailing list