how do you use rm to del found files

Rich Edelman edelman at speedscript.com
Thu Jun 27 15:13:06 CDT 2002


Since -print is the default behavior for find (well, at least GNU find and SCO 
find, which is admittedly all I've used), you really don't need that 
argument. Also, instead of using the -exec arg, you can just pipe find's 
output through xargs rm, which is my preferred method:

find . -name '*.class' | xargs rm

would accomplish the same thing. Just letting you know there's more than one 
way to do it.  Ack, a Perl saying! I must go pray to the Python gods now. :)

Rich

On Thursday 27 June 2002 10:01 am, Gene Dascher wrote:
> This should do it for you:
>
> find . -name "*.class" -exec rm -rf {} ; -print
>
> Gene
>
> > -----Original Message-----
> > From: owner-kclug at marauder.illiana.net
> > [mailto:owner-kclug at marauder.illiana.net]On Behalf Of Hanasaki JiJi
> > Sent: Thursday, June 27, 2002 8:51 AM
> > To: KCLUG
> > Subject: how do you use rm to del found files
> >
> >
> > I have a find expression:
> > 	find . -name *.class -print
> > that outputs a list of files
> >
> > how can i send this to "rm" to remove all these files?
> >
> > Thanks
> >
> >
> >
> >
>




More information about the Kclug mailing list