Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 12-22-2004, 04:00 PM   #1
LQ Newbie
Registered: Feb 2002
Distribution: Ubuntu Edgy Eft
Posts: 27

Rep: Reputation: 15
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?

Old 12-22-2004, 04:04 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 65
Probably the easiest is to use:
find ./ -type d -name "CVS" -exec rm -rf {} \;
Old 12-22-2004, 04:43 PM   #3
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840

Rep: Reputation: 31
Well... this should work..

$ rm -rf CVS
Old 12-22-2004, 04:46 PM   #4
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,047
Blog Entries: 11

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Originally posted by UltimaGuy
Well... this should work..

$ rm -rf CVS
That won't traverse all subdirectories ...

Old 12-22-2004, 05:22 PM   #5
LQ Newbie
Registered: Feb 2002
Distribution: Ubuntu Edgy Eft
Posts: 27

Original Poster
Rep: Reputation: 15
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?
Old 01-14-2007, 10:48 PM   #6
Registered: Jan 2003
Location: New Mexico
Distribution: SuSE 9.2 Professional, OpenSuSE 10.1 64 bit, Open SuSE 10.2, Debian Etch
Posts: 535

Rep: Reputation: 30
Originally Posted by david_ross
find ./ -type d -name "CVS" -exec rm -rf {} \;
thanks, just the thing i need (2 years later)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using chmod to recursively change directories / files [GOD]Anck Linux - Software 6 11-10-2008 07:16 PM
List all files and recursively open directories. unreal128 Linux - General 2 07-16-2005 03:06 PM
Can ls recursively list only directories? Vosper Linux - General 3 07-16-2005 04:57 AM
tar, excluding directories recursively towlie Linux - Newbie 3 06-17-2004 01:32 PM
recursively listing directories full paths kubicon Linux - Newbie 2 02-22-2004 04:55 PM

All times are GMT -5. The time now is 11:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration