Remove directories and files recursively using mask???

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Remove directories and files recursively using mask???

Post by alex.barylski »

Code: Select all

rm -r *.svn /var/www/projects
Basically I am trying to remove the files and directories created by subversion...I suppose I could import/export but this seems easier. Is the above right?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Remove directories and files recursively using mask???

Post by Christopher »

No, you need to use find.
(#10850)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Remove directories and files recursively using mask???

Post by alex.barylski »

Ah...sweet...thanks man :)
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Remove directories and files recursively using mask???

Post by Benjamin »

Just for reference:

Code: Select all

rm -rf `find . -type d -name .svn`
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Re: Remove directories and files recursively using mask???

Post by timvw »

actually you could also let find perform the rm... if i'm not mistaken arguments would be something like:

find xxxx -exec rm {} \;
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: Remove directories and files recursively using mask???

Post by Jenk »

The above (timvw's suggestion) is what I use when needing to achieve this.
Post Reply