removing a file with hyphens

David Cantrell david at cantrell.org.uk
Thu Jun 7 14:13:42 BST 2007


On Thu, Jun 07, 2007 at 01:50:14PM +0100, Jonathan Stowe wrote:
> On Thu, 2007-06-07 at 13:20 +0100, Matt Wilson wrote:
> > > #  find . -name '*Original' -exec rm {} \;
> > ARGH!
> Yeah, could have at least used the '-delete' action of 'find' to save
> the potential deaths of thousands of angels/fairies/kittens/(whatever it
> is that dies when you fork).

It's easier to test the -exec version:

  find . -name foo\* -exec echo rm {} \;

to make sure you're deleting the right stuff.  Additionally, -delete
seems to be a GNUism.  At least, it's not documented on the NetBSD box
whose find manpage I just looked at.

xargs -n is what you want if you want to be kind to angels/fairies/
kittens.

-- 
David Cantrell | Godless Liberal Elitist

There's a hole in the world like a great black pit
And the vermin of the world inhabit it
And its morals aren't worth what a pig could spit
And it goes by the name of London.


More information about the london.pm mailing list