The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

    20140508-Delphi-2007--Project-Options--Cannot-Edit-Application-Title-HelpFile-Icon-Theming

    20140430-Fiddler-Filter-Actions-Button-Run-Filterset-now

    20140424-Windows-7-free-disk-space

    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,298 other followers

“tfpt treeclean /exclude:*.suo,*.user” is what I use most (and recommend this thread: Does any tool exist to help Sync a directory with TFS? – Stack Overflow)

Posted by Jeroen Pluimers on 2012/09/20

This post describes the TFS workspace cleanup features Treeclean and Scorch.

Both are not in the Visual Studio UI nor TFS tool, but are available form the ftpt command from the optional Team Foundation Power Tools package.

The main reason you need these two features is that TFS does not always clean up after it self when you perform get latest. For instance renamed directories, as well as bin and obj directories are not automatically removed.

The tfpt command I most often use this this one:

tfpt treeclean /exclude:*.suo,*.user

This deletes files from your local TFS workspace directory tree that are not in the source control system, but skips the *.suo and *.user files.

Tfpt also allows you to scorch files from your TFS.

So my second most used tfpt command is scorch in either of the two below forms:

tfpt scorch /recursive /diff
tfpt scorch /recursive /diff /exclude:*.suo,*.user

The first form is for the automatic build environment, the second for my normal development workspace.

Below is the explanation of treeclean and scorch.

First some other great commands from this StackOverflow answer by Martin Woodward:

Not quite, however you might want to download the TFS Power Tools and check out the command line utility tfpt.exe.

The “tfpt online” and “tfpt treeclean” might be most useful to you when working outside of an integrated TFS client. tfpt online will look for files in your local directory that are not under version control, treeclean will show you files in your local directory that are not under version control so that you can remove then if they are not required.

Scorch versus Treeclean

Scorch does more than Treeclean.

I use Treeclean for 90% of my normal workspace work, Scorch (with exclude) for about 10% of the time in my regular workspace.
For my CCnet build integration workspace, I only use Scorch (without exclude).

Treeclean just cleans the tree of stuff that is not in TFS:

B:\MasterWorkingDir>tfpt treeclean /?
tfpt treeclean - Delete files and folders not under version control

Usage: tfpt treeclean [/exclude:filespec1,filespec2,...] [filespec...]
[/recursive] [/batchsize:num] [/noprompt [/preview]]

Scorch does more work: at the end, both source control and the local disk situation are identical.

B:\MasterWorkingDir>tfpt scorch /?
tfpt scorch - Ensure source control and the local disk are identical

Your local disk will be scanned for:
 (1) items that are not in source control
 (2) items which are different on disk from the workspace version
 (3) items which are in the workspace but are missing on disk
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.

By default, items deleted from your local disk (#3 above) will not be
scanned for, and local items are determined to be identical/different from
the workspace version *solely by examining the read-only bit on the file*.

To redownload items deleted from your local disk (#3 above), supply the
/deletes option. To detect items which are different from the workspace
version but still have their read-only bit set (+R), supply the /diff option.
When using either or both of these options, tfpt scorch runs more slowly.

Usage: tfpt scorch [/exclude:filespec1,filespec2,...] [filespec...]
[/recursive] [/batchsize:num] [/noprompt [/preview]]
[/deletes] [/diff]

The commandline options are also different.

Scorch has these extra when compared to Treeclean:

/batchsize:num Set the batch size for server calls (default 500)
/deletes Detect and replace items missing from the local disk
/diff Use MD5 hashes to compare items with source control

Treeclean can have these options:

/noprompt Operate in command-line mode only
/exclude:filespec[,..] Files and directories matching a filespec in this list
are excluded from processing
/preview Do not make changes; only list the potential actions
/recursive Switch from one level of recursion to full recursion
/batchsize:num Set the batch size for server calls (default 500)
filespec... Only files and directories matching these filespecs
are processed

Scorch can have these options:

/noprompt Operate in command-line mode only
/exclude:filespec[,..] Files and directories matching a filespec in this list
are excluded from processing
/preview Do not make changes; only list the potential actions
/recursive Switch from one level of recursion to full recursion
/batchsize:num Set the batch size for server calls (default 500)
filespec... Only files and directories matching these filespecs
are processed

–jeroen

via:

2 Responses to ““tfpt treeclean /exclude:*.suo,*.user” is what I use most (and recommend this thread: Does any tool exist to help Sync a directory with TFS? – Stack Overflow)”

  1. Bo said

    Nice article. I have one question. How do we specify the exclude file, for example, all the files in Bin directory.. I’ve tried a lot of times and can not come up the correct grammar…

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 1,298 other followers

%d bloggers like this: