Removing .svn files from all directories
Solution 1
You can do a thing called an SVN Export to get the files without the .svn directories
http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.export.html
Solution 2
I'm not sure in your specific case that you want to remove all those .svn directories. But if you do, here is a bash one-liner to do just that:
find . -name .svn -print0 | xargs -0 rm -r
Solution 3
on Win32/Win64 systems, the following command should do the job:
del /q /s .svn
Solution 4
I posted this yesterday over here, but here is again because I kind of put it in the wrong thread anyway...
I've got something that should make your day. Original source is here.
This is a (perfectly safe) Shell Extension that will add "Delete SVN Folders" to your right click menu in Windows. Run it on any directory containing those pesky files.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@="Delete SVN Folders"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn) DO RD /s /q \"%%f\" \""
To make this part of your build script copy that call to cmd.exe and execute it.
Solution 5
find . -name '.svn' -depth -exec rm -rf '{}' \; -ls
Mike2012
Updated on July 26, 2020Comments
-
Mike2012 almost 4 years
Possible Duplicate:
How do you remove Subversion control for a folder?
Command line to delete matching files and directories recursivelyI recently converted my cvs repository to svn using cvs2svn and I recently noticed that every directory has a hidden folder called .svn. My current build script copies a lot of directories from my versioned resources directories and it ends up copying the .svn files. Is there anyway to make svn not include these files when I checkout or do I need to write a script to delete all these .svn files. There are many files that have these hidden .svn directories so this would be a pain unless I could write a recursive script to do this but I don't if I can do this for my windows installer. Is there an easy way to stop svn from putting this hidden directory everywhere in my project?
-
Jon Onstott almost 15 yearsYep, SVN Export will remove the .svn files. You could make a batch file to run the export command from the command line and incorporate that into your build process.
-
crashmstr almost 15 yearsDeleting them is not a good idea unless you want that folder to NOT be a working copy anymore.
-
jray over 14 yearsSometimes one inherits code where this is just more useful. Thanks!
-
Admin almost 14 yearscheck this link it helped me.... cocoabugs.blogspot.com/2010/09/…
-
Eva almost 12 yearsthis is great, but unfortunately sometimes someone sends you a tarball full of them :(
-
Rid Iculous over 10 yearsWhy is this the accepted answer? It actually doesn't anwser the question at all. If you don't have SVN at your disposal it's useless and if you do it doesn't remove the directories. It creates a copy of the existing files omitting the .svn files. Yes, I'm splitting hairs, but this is IT, right? As per stackoverflow.com/questions/4889619/… running FOR /F "tokens=*" %G IN ('DIR /B /AD /S .svn') DO RMDIR /S /Q "%G" is a much better answer
-
Roland almost 10 yearsupvote for Windows users that have cygwin installed. Still I find using the File Explorer search box much easier.
-
Camaleo over 9 yearsbefore running the command be sure to enter the proper directory, example: cd mySVNdirectoryWhereToRemoveTheSubfolders