Cleaning up Visual Studio TestResults with PowerShell

Jul 10 2009

If you write your unit tests using Visual Studio, then you know how quickly those pesky "TestResults" folders can eat up precious disk space over time. Here is a simple, yet effective PowerShell script to seek and destroy them!

Assuming all of your code is collocated in the same parent directory, replace "C:\Projects" with your parent directory.
(get-childitem C:\Projects\* -recurse) | where{$_.name -eq "TestResults"} |% {remove-item $_.fullname -recurse}

Disclaimer

The words and opinions expressed here are those of each article's respective author, and do not necessarily represent the views of CapTech Ventures.