r/tinycode • u/trusted_anon • Jul 13 '12
Remove all .svn folders from your code tree
find . -name .svn -exec rm -rf {} ;
15
u/BioSammyj Jul 13 '12
Or upgrade to Subversion 1.7+ and there's only one .svn folder at the working directory root.
15
u/peterlada Jul 13 '12
Or just learn to use svn.
See: svn export
4
u/pertheusual Jul 13 '12
Exporting isn't the only time you'd want to remove .svn folders though.
4
u/peterlada Jul 13 '12
Removing .svn folders will guarantee an export (ie. no going back). I'd need an example use case to accept you assertion ;)
3
u/Moocha Jul 24 '12
Here you go: Have someone's project mailed to you, notice it's a straight archive of that someone's working copy, get annoyed by all the (for you, as an external entity) unusable .svn directories that slow down the extraction.
Granted, it's still an export, but
svn exportis out of the question if you don't have access to the repository.2
4
2
u/phoozle Jul 13 '12
Great way to upgrade to Git :)
16
u/inkieminstrel Jul 13 '12
Not really. You'd want to use git-svn, which can convert a svn repo to a git repo without losing commit history.
-5
u/nexe mod Jul 13 '12
He's right. GIT > SVN
7
u/recursive Jul 13 '12
As far as I can tell, the worst thing about git is the proselytism of its users.
2
u/marburg Jul 13 '12
That fact is sort of a testament to how great
gitis. :)I mean, if the worst thing about it is how people won't shut up about how much they enjoy it.
2
u/recursive Jul 13 '12
If that's a measure of greatness, it still has room for improvement. It's not quite vim status yet. :)
1
u/marburg Jul 13 '12
hahaha woah; that is a lofty comparison! Let's give
gita couple decades, and we'll see how it compares.3
1
u/jonikanerva Jul 14 '12
You could also use the -delete option to delete all the matched files:
find . -name .svn -type d -delete1
u/dAnjou Jul 15 '12
This only does delete empty directories and files.
.svndirectories are not empty if I recall correctly.
1
u/chrisdown Sep 14 '12
Or in pure bash:
shopt -s globstar nullglob
for file in **/.svn; do
[[ -d $file ]] && rm -rf "$file"
done
17
u/Moocha Jul 13 '12 edited Jul 13 '12
That doesn't do what you claimed it does. It will find and remove any file system object named
.svn, including files, pipes, devices and so on. Granted, that's a bit of a nitpicking thing, but this isn't exactly the correct subreddit for this either so I feel justified poking you :)If you only want to remove the directories, tell
findto only match directories:Or a faster alternative that doesn't spawn a
rmprocess for every matched item:The-0is technically unnecessary since items named.svnwon't ever have spaces and other unprintable chars in them, but it's a good habit to pick up.Edit: Oh yes it's necessary :) Thanks for catching that, snf and notwolverine.