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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
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: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
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: Ubuntu 18.04.3 LTS
Posts: 539
Rep:
|
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 06:06 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
|
|