How can I rename all hidden directories under the current directory in DOS?
dos, tortoisesvn, windows
Solution
The following batch file will do the trick, at least on Windows which I hope you are using (no luck in DOS here):
@echo off
call :recurse .
goto :eof
:recurse
for /d %%d in (*) do (
pushd %%d
attrib -H .svn >nul 2>&1
ren .svn _svn >nul 2>&1
attrib +H _svn >nul 2>&1
call :recurse
popd
)
goto :eof
The problem is that `ren` refuses to rename hidden directories. And `for /R` seemingly never really works when trying to find directories. So I am building a little recursion through the directory tree here and for each directory I am entering I clear the hidden flag from the `.svn` folder, rename it, and hide the file again.
Due to re-setting the hidden flag and `for /D` never returning hidden directories this also has the nice benefit of not attempting to enter the `.svn` or `_svn` directories.
Problem
How can I rename all hidden directories under the current directory in DOS? I've just updated Tortoise SVN to use _svn instead of .svn. I noticed that it still works if I just rename the folders.