Click here to Skip to main content
Click here to Skip to main content

Recursively remove .svn folders

By , 10 Jun 2012
 

You're a developer, you need a source control system

So far in my experience I've used a few. Floppys, DVD-RW's, thumb drives, external hard drives, emailing myself zipped up folders, Cloud Storage (Microsoft's SkyDrive), to Microsoft's Visual Source Safe, SVN, and Microsoft's Team Foundation Server.

As of the last few years I've been using SVN and I'm pretty happy with it!  The local comparison's offer good speed instead of doing a client-server compare every time I need to check and it's very simple to manage multiple checkouts and merge (if you ask me); but there's one catch to all that...  if creates a local copy of every file in a hidden .svn folder parent to the directory.  When it comes time to copying a folder, you're doing twice the work and twice the storage.

I know I'm not alone with this endeavor. Many colleagues and friends express the same challenge when they want to just share the actual code and not the duplicated folder's created. 

So, that being said

If you've ever wanted to remove all those hidden .svn folders that are created by SVN, here is a simple bat script to do that work for you. Just save it as RemoveSVN.bat and let this take care of the rest.

@echo off
echo Please enter a full directory to remove SVN hidden directories from:
set /p SVNDir=
cd %SVNDir%
dir treelist
for /f "delims=" %%x in ('dir /b /ad /S .svn*') do rd /s /q "%%x"
pause

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

DillonRaney
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionNot neededmvpMehdi Gholam10 Jun '12 - 10:47 
If you upgrade to the newest version of TortoiseSVN, it will only create one .svn folder in the project root, which is a godsend.
Its the man, not the machine - Chuck Yeager
If at first you don't succeed... get a better publicist
If the final destination is death, then we should enjoy every second of the journey.

AnswerRe: Not neededmemberBigTimber@home11 Jun '12 - 4:36 
One exception -- this is true unless you use svn-externals; if you do use externals, it will still populate your tree with .svn folders locally in any of your external'd elements.
SuggestionTortoise SVN: ExportmemberN-O-R-B-E-R-T10 Jun '12 - 10:35 
Since you are on Windows I'd guess you are using Tortoise SVN. The TSVN Windows Explorer context menu has the option to export your repository (with or without additional files in the folders, that are not under version control) which should be the same thing as removing all .svn folders. It's a temporary copy, so if you want to save space you need to remove the original repository afterwards, but I think it's still easier to use the readymade functionality of TSVN and delete the repository afterwards.
 
Norbert
GeneralRe: Tortoise SVN: ExportmemberSteveKing10 Jun '12 - 22:29 
Export to itself: http://tortoisesvn.net/unversion.html[^]

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 10 Jun 2012
Article Copyright 2012 by DillonRaney
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid