I have a USB-stick which acts as my backup. As I program a lot compilation and unit testing produces a lot of trash (.pdb, Test Results, obj-files etc). I don’t want or need a backup of those.
Today I found a short script that removes those file. Since I have folders named “bin” I want to keep I tweaked it a bit into this:
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S Debug') DO RMDIR /S /Q "%%G" FOR /F "tokens=*" %%G IN ('DIR /B /AD /S _Resharper*') DO RMDIR /S /Q "%%G" FOR /F "tokens=*" %%G IN ('DIR /B /AD /S TestResults') DO RMDIR /S /Q "%%G" FOR /F "tokens=*" %%G IN ('dir /b /A /S *.vsmdi') DO RMDIR /S /Q "%%G"
I don’t know if you are like me and don’t know the first things of DOS. Well this script deletes the following:
- All Debug-folders (both obj/Debug and bin/Debug)
- All folders that Resharper generates for you
- All TestResults folder (they can be massive!!)
- All the crazy vsmdi-files that hold testlist for you