Removing .svn files from all directories

49,905

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

Share:
49,905
Mike2012
Author by

Mike2012

Updated on July 26, 2020

Comments

  • Mike2012
    Mike2012 almost 4 years

    Possible Duplicate:
    How do you remove Subversion control for a folder?
    Command line to delete matching files and directories recursively

    I 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
    Jon Onstott almost 15 years
    Yep, 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
    crashmstr almost 15 years
    Deleting them is not a good idea unless you want that folder to NOT be a working copy anymore.
  • jray
    jray over 14 years
    Sometimes one inherits code where this is just more useful. Thanks!
  • Admin
    Admin almost 14 years
    check this link it helped me.... cocoabugs.blogspot.com/2010/09/…
  • Eva
    Eva almost 12 years
    this is great, but unfortunately sometimes someone sends you a tarball full of them :(
  • Rid Iculous
    Rid Iculous over 10 years
    Why 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
    Roland almost 10 years
    upvote for Windows users that have cygwin installed. Still I find using the File Explorer search box much easier.
  • Camaleo
    Camaleo over 9 years
    before running the command be sure to enter the proper directory, example: cd mySVNdirectoryWhereToRemoveTheSubfolders