Clean TFS Workspaces with Scorch & Treeclean

If you’ve been working with a TFS workspace for a long time, you know it can get filled up with all kinds of built objects and temporary files. There’s a super-easy way to clean-up using the TFS PowerTools, though.

Check out these two commands:

  • tfpt scorch – Ensure source control and the local disk are identical
  • tfpt treeclean – Delete files and folders not under version control

(Taken from this MSDN forum post.)

7/2/2013 Update:
A co-worker and I were reviewing the scorch command and whether or not pending changes will be deleted through its use. That concern is addressed directly in the help text for the command, accessed by running tfpt scorch /? from the command prompt. Note the last line in the excerpt below, highlighted in red.

Items not in source control will be deleted from disk, just as with the tfpt treeclean command. Items determined to be different on disk from the workspace version will be redownloaded from the server. Items missing on disk will also be redownloaded. Items with pending changes are exempted.

So, it is safe to use scorch while you have pending changes; they will simply be ignored.


Author: Adam Prescott

I'm enthusiastic and passionate about creating intuitive, great-looking software. I strive to find the simplest solutions to complex problems, and I embrace agile principles and test-driven development.

3 thoughts on “Clean TFS Workspaces with Scorch & Treeclean”

  1. Another quick tip!
    When I use this, I don’t want it to blow out my solution .suo files. There’s a “/exclude” option you can use to skip ’em.

    tfpt treeclean /exclude:*.suo

Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: