Share your knowledge at the LQ Wiki.
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, 03: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, 03:04 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

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

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

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

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

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

Old 12-22-2004, 04: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, 09:48 PM   #6
Registered: Jan 2003
Location: New Mexico
Distribution: Ubuntu 18.04.3 LTS
Posts: 539

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 06:16 PM
List all files and recursively open directories. unreal128 Linux - General 2 07-16-2005 02:06 PM
Can ls recursively list only directories? Vosper Linux - General 3 07-16-2005 03:57 AM
tar, excluding directories recursively towlie Linux - Newbie 3 06-17-2004 12:32 PM
recursively listing directories full paths kubicon Linux - Newbie 2 02-22-2004 03:55 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:50 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