how do you use rm to del found files
Duston, Hal
hdusto01 at sprintspectrum.com
Thu Jun 27 15:16:26 CDT 2002
dattaway at attaway.net [mailto:dattaway at attaway.net] wrote:
> On Thu, 27 Jun 2002, Gene Dascher wrote:
>
> > This should do it for you:
> >
> > find . -name "*.class" -exec rm -rf {} ; -print
>
> or use the handy backticks, which runs the commands placed
> within them,
> returning its output in its place:
>
> rm `find . -name *.class -print`
The first solution suffers from calling rm individually on
each file to be removed, and is therefore slower on large
numbers of files..
The second solution suffers from "not working" if the size
of the list of files exceeds the kernel's command line
limitation.
A solution which suffers from neither of these problems is
find . -name '*.class' -print | xargs rm
Hal
More information about the Kclug
mailing list