Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Recursively remove .svn directories

Terminal - Recursively remove .svn directories
find . -type d -name .svn -delete
2010-03-01 18:48:31
User: jmcantrell
Functions: find
4
Recursively remove .svn directories

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives
find . -name .svn -exec rm -r {} +;
find . -iname ".svn" | xargs rm -r $1
find -type d -name ".svn" -print0 | xargs -0 rm -rf
2010-02-25 10:16:18
User: tuxilicious
Functions: find rm xargs
-1

man find: If no paths are given, the current directory is used. - Can anybody tell me why so many people are typing the dot?

rm -rf `find . -name .svn`
2010-02-23 08:35:06
User: jfcalvo
Functions: rm
-2

Recursively remove .svn directories from the current location.

ls -RAx | grep "svn:$" | sed -e "s/svn:/svn/" | xargs rm -fr

Know a better way?

If you can do better, submit your command here.

What others think

It took 6 times to get this simple command right? And i hate to break it to you, but you should be using "svn export" anyway, especially since you're likely to have your working copy in some special location for working copies only

Comment by rkulla 237 weeks and 1 day ago

No idea what gt3 is trying to say, but... Downvoting this because it does not work. The -delete option won't remove nonempty directories, at least on my system. and .svn directories will always be nonempty. You could try to contort find to your will, but -prune won't work with -delete. You have to do something like the solution by nishan_n (#4917).

Comment by bwoodacre 237 weeks and 1 day ago

bwoodacre, if you click the title of the cmomand 'Recursively remove .svn directories' there's 5 previous attempts by other people to do this command on commandlinefu.com. That's what I meant by "it took 6 times".

However, you're correct, this command is wrong and will report "Directory not empty". I should have said that nishan_n had it closer but i still think people should just use 'svn export' if they want to get rid of the .svn directories safely.

Comment by rkulla 237 weeks ago

You are right, the suggestion to use svn export is easier and less error-prone if you just want a .svn-free version of a particular chunk of a *repository*. But that doesn't handle any differences that your working copy has: unversioned files that you want to keep around, or checked-in files with changes that you don't want committed.

Comment by bwoodacre 237 weeks ago

Your point of view

You must be signed in to comment.

Related sites and podcasts