[LUNI] Re: Basic "find" question
Fred Yankowski
fred at ontosys.com
Fri Jun 22 08:20:55 CDT 2007
On Fri, Jun 22, 2007 at 06:35:57AM -0500, Stefmit wrote:
> Can't remember how this one works ... while:
>
> $ find . -name Dir_name -type d -print0 |xargs -0 ls
>
> will list all files and subdirs in the directory Dir_name, for all places
> where a Dir_name is found under ".", would replacing 'ls' with 'rm -fR' lead
> to removing all those files and subdirs, leaving the Dir_name intact, or
> else?
That would wipe out every Dir_name directory too.
I think the following does what you want:
find . -path '*/Dir_name/*' ! -type d -print0 | xargs -0 rm
find . -path '*/Dir_name/*' -type d -print0 | xargs -0 rmdir
--
Fred Yankowski
More information about the luni
mailing list