These days i've starting using PowerShell, it is a pleasure!
it is a long time that i want to learn PowerShell and finally i've found some occasion to give it a try.
It is like a drug, i can't stop using it!
despite the fact that my company have lent to me a new laptop, a shiny i5 with SSD disk, this new hardware has a 128GB disk, that it is ok for the OS only in these days.
Considering that my phone has 32 and my next one probably 128... basically i'm doing my company business by phone :(
ok stop ranting and let's go to the point.
i've to clean all the cap that VisualStudio 2010 produces when compiles.
I've a big solution with 70+ projects, belive me or not, the amount of DLL plus OBJ and pdb it produces it is more or less 400Mb some day more some day less
then i've created this nice script
dir -Recurse -Attributes Directory |`
where -Property Name -ne 'Packages' |`
dir -Recurse -Attributes Directory |`
where {($_.Name -match 'bin') -or ($_.Name -match 'obj')} |`
remove-item -Recurse -force
dir -Recurse -Attributes Directory |`
where -Property Name -eq 'TestResults' |`
remove-item -Recurse -force
basically it starts from the root you launch it in and search for all the BIN or OBJ folder not under packages (in great respect of nuget) and delete the entire hierarchy under BIN and OBJ
it frees up a lot of space and it took me 5 minutes to write it.
I LOVE POWERSHELL!
Tags: PowerShell Script VisualStudio