Cleanup build directories

When developing with Visual Studio it is sometimes necessary to make sure no old files are roaming the build directory.

This is also true if you try to debug strange behavior, for example implicit cyclic references between two or more distinct VS projects. That may occur when using an IoC container to back-reference types in a class library project. The dll will be missing during the first build, but be available during the second build, but they will also be deprecated because they do not belong to the latest build.

Anyway, this little script traverses the folder structure in which it resides and purges the listed directories, in this case the folder bin, obj and testresults.

Also, it is awesome.

for /d /r . %%d in (bin,obj,testresults) do @if exist "%%d" rd /s/q "%%d"


Skip to toolbar