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
Advertisements
Tagged ,

One thought on “Clear all .svn bindings from a directory

  1. alex says:

    powershell makes life easier

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: