delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/15/15:47:41

From: jrl AT netcom DOT com (Dr. J. Robert Lee)
Newsgroups: comp.os.msdos.djgpp
Subject: recursive rm
Date: 15 May 2000 19:22:54 GMT
Organization: NETCOM / MindSpring Enterprises, Inc.
Lines: 38
Message-ID: <8fpiqe$gpr$1@slb6.atl.mindspring.net>
NNTP-Posting-Host: c7.b7.09.70
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Apologies to anyone who read this note in the Unix,
newsgroup. Turns out that I should have posted it
here. The answers that I received from that other
group work fine with the Unix "find" command, but
not with DOS.

"Dr. J. Robert Lee" wrote to the wrong newsgroup:
> 
> rm -r dirname   removes the directory "dirname" and
> all the files and directories within it. While that
> is a useful tool, there is a releated but distinct
> behavior that I often need. That is, I want to be
> able to delete all the files that have a certain
> name or part of the name in a subdirectory tree.
> 
> For example, suppose there are files called
> 
> /frog/toad/bill/fred/tadpole.o
> /frog/toad/bill/squid.o
> /frog/toad/polywog.o
> /frog/food.o
> /frog/puddle.o
> 
> What I would like to be able to do is execute a
> command such as the following to get rid of all
> of the files that end in .o

These are the suggestions for Unix. DOS anyone?

find . -name "*.o" -exec rm {} \;

with zsh you can write 
rm **/*.o


--
J. Robert Lee, Ph.D.
jrl AT netcom DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019