Monthly Archives: May 2011

Clear all .svn bindings from a directory

dir /B /S ".svn" /AD >a.list & for /F "delims=" %a in (a.list) DO (attrib -H "%a" & rd /Q /S "%a") & del /Q a.list

Similarly – clear all bin/obj/resharper directories

dir /B /S "bin" /AD >a.list & for /F "delims=" %a in (a.list) DO (attrib -H "%a" & rd /Q /S "%a") & del /Q a.list
dir /B /S "obj" /AD >a.list & for /F "delims=" %a in (a.list) DO (attrib -H "%a" & rd /Q /S "%a") & del /Q a.list
dir /B /S "_ReSharper*" /AD >a.list & for /F "delims=" %a in (a.list) DO (attrib -H "%a" & rd /Q /S "%a") & del /Q a.list

Note to self – use double ampersands in batch files.

Batch script to clean a solution folder

dir /B /S ..\"bin" /AD >a.list & for /F "delims=" %%a in (a.list) DO (attrib -H "%%a" & rd /Q /S "%%a")
dir /B /S ..\"obj" /AD >b.list & for /F "delims=" %%a in (b.list) DO (attrib -H "%%a" & rd /Q /S "%%a")
dir /B /S ..\"_ReSharper*" /AD >c.list & for /F "delims=" %%a in (c.list) DO (attrib -H "%%a" & rd /Q /S "%%a")
dir /B /S ..\"Debug" /AD >d.list & for /F "delims=" %%a in (d.list) DO (attrib -H "%%a" & rd /Q /S "%%a")
dir /B /S ..\"x64" /AD >e.list & for /F "delims=" %%a in (e.list) DO (attrib -H "%%a" & rd /Q /S "%%a")

GOTO EOF

del a.list
del b.list
del c.list
del d.list
del e.list

:EOF
Tagged ,