Twitter
Powered By
Powered by Squarespace
Navigation
« Using a script to set the Copy Local flag to false | Main | Connecting an iOS device to a mixed 802.11b/n WiFi network »
Tuesday
Oct162012

Deleting all bin and obj folders from a solution

Quick little post.

Since reading The Pragmatic Programmer by Andrew Hunt and David Thomas I've been looking for ways to automate tasks whenever I find myself doing something I know I'm going to repeat later or I'm repeating right there and then.

The other day I was working on a VisualStudio Solution someone else had started and when trying to build it found they had checked in some of the bin and obj folders.

So I open up the root folder of the solution and prepare to trawl through about a dozen projects to delete all the bin and obj files. Obviously noticing that I'm about to do the same steps repeatedly and this will happen in the future I went and did a quick search to see if anyone else had already solved this.

Awesomely someone had.

So a huge thanks to Glenn at Development on a shoestring for providing exactly what I needed. I'm putting this here just in case his site should disappear and take the knowledge with it.

I threw the following into a powershell script that sits in source control ready for use in the future

# Iterate through all subdirectories and delete all bin and obj folders
# http://blog.slaven.net.au/2006/11/22/use-powershell-to-delete-all-bin-obj-folders/
# Had to use it for getting rid of a bunch of bin and obj folders in a PoC but thought it smart to put in here for other to use
Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }
RemoveAllBinAndObjFolders.ps1

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (16)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Source
  • Response
    Recycling bins happen to be made for business, industrial, and home-based use. Those produced for commercial and industrial use are built to be way more tough. Be certain that to maintain this in mind when deciding on bins for purposes aside from household use..
  • Response
    Response: fun run cheats
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Response: Click Here!
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Response: fun run hack
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Response: Frank Dellaglio
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Response: tangkasnet
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Response: phytolyft Reviews
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Response: see it here
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Response: visit site
    Deleting all bin and obj folders from a solution - Thoughts - TFG
  • Response
    Deleting all bin and obj folders from a solution - Thoughts - TFG

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>