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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
12-22-2004, 03:00 PM
|
#1
|
|
LQ Newbie
Registered: Feb 2002
Distribution: Ubuntu Edgy Eft
Posts: 27
Rep:
|
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.
|
|
|
|
12-22-2004, 03:04 PM
|
#2
|
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Probably the easiest is to use:
find ./ -type d -name "CVS" -exec rm -rf {} \;
|
|
|
|
12-22-2004, 03:43 PM
|
#3
|
|
Member
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840
Rep:
|
Well... this should work..
$ rm -rf CVS
|
|
|
|
12-22-2004, 03:46 PM
|
#4
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Quote:
Originally posted by UltimaGuy
Well... this should work..
$ rm -rf CVS
|
That won't traverse all subdirectories ...
Cheers,
Tink
|
|
|
|
12-22-2004, 04:22 PM
|
#5
|
|
LQ Newbie
Registered: Feb 2002
Distribution: Ubuntu Edgy Eft
Posts: 27
Original Poster
Rep:
|
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?
|
|
|
|
01-14-2007, 09:48 PM
|
#6
|
|
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:
|
Quote:
|
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 |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:34 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|