LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Remove directories recursively with same name (http://www.linuxquestions.org/questions/linux-newbie-8/remove-directories-recursively-with-same-name-269280/)

cboyd 12-22-2004 03:00 PM

Remove directories recursively with same name
 
I know this should be a very simple thing to do, but I can't seem to figure out how to do this. I have a folder that contains the directory named CVS in it and in all of the subdirectories. I need to remove all of these directories. I tried rm -rf */CVS/* but this didn't work. I've tried other variations of the command with no luck. Could someone pls help?

Thanks.

david_ross 12-22-2004 03:04 PM

Probably the easiest is to use:
find ./ -type d -name "CVS" -exec rm -rf {} \;

UltimaGuy 12-22-2004 03:43 PM

Well... this should work..

$ rm -rf CVS

Tinkster 12-22-2004 03:46 PM

Quote:

Originally posted by UltimaGuy
Well... this should work..

$ rm -rf CVS

That won't traverse all subdirectories ...


Cheers,
Tink

cboyd 12-22-2004 04:22 PM

Thanks david_ross!! The find command worked great. I would think this functionality would be included in the rm command. Anyone know if there is a way to do this with the rm command only?

allelopath 01-14-2007 09:48 PM

Quote:

Originally Posted by david_ross
find ./ -type d -name "CVS" -exec rm -rf {} \;

thanks, just the thing i need (2 years later)


All times are GMT -5. The time now is 11:22 PM.