LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 12-22-2004, 03:00 PM   #1
cboyd
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?

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

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

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

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

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

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


Cheers,
Tink
 
Old 12-22-2004, 04:22 PM   #5
cboyd
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
allelopath
Member
 
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
Quote:
Originally Posted by david_ross
find ./ -type d -name "CVS" -exec rm -rf {} \;
thanks, just the thing i need (2 years later)
 
  


Reply


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


All times are GMT -5. The time now is 03:59 AM.

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