Bulk renaming _svn folders to .svn

A long time ago I set TortoiseSVN to use _svn for the folder name instead of .svn because I had heard somewhere that .svn caused conflicts with Visual Studio or IIS (I can’t recall the exact details). While setting up my new computer, I didn’t want to apply this setting again because it’s not the default and there’s no conflict with recent versions of Visual Studio. After a short search, I found the following batch file which I modified slightly for my situation.

WARNING: Use at your own risk – Works on my machine™

FOR /R %%f IN (_svn) DO IF EXIST "%%f" (
     ATTRIB -h "%%f"
     RENAME "%%f" .svn
     ATTRIB +h "%%f"
)

Copy this into a new text file, save the file, and rename it to updatesvn.bat. Then, place this file in the folder that you want to update it and double click to run. It will update the folder it’s in and all subfolders.

The batch file looks for folders named _svn, removes the ‘Hidden’ attribute, renames the folder to .svn and adds the ‘Hidden’ attribute back.

Posted January 12th, 2009 6:07 PM
Read more posts about Tips.

Comments
Link

  • Thanks for posting the snippet, I've found it very helpful. However I think the second attrib ends up using the original folder name, not the newly renamed folder. The result is the resulting .svn directories are not hidden. I changed it to attrib +h "%%f\..\.svn" and that did the trick!
  • Thanks!
  • CN
    I've learnt that platonic love can exist between two grown men.
  • sri
    this is just what i wanted. thank you so much.
blog comments powered by Disqus