William Thomas Waller
William Thomas Waller

Reputation: 697

Deleting non-source-control folders/files from a local TFS workspace

Our dev branch at work is pretty huge, and sometimes I drop my own .sln files in there or other stray files, but I want a way to delete anything that isn't strictly source control within that local mapping.

How would I do this? Is there a tfpt/tf command for it?

This is also relevant to me because sometimes a folder will get deleted from source control but tf get won't delete it because "folder not empty". I'd like to delete all these without scorching my workspace.

Upvotes: 4

Views: 654

Answers (3)

pogosama
pogosama

Reputation: 1908

The Team Foundation Version Control Tool (tf.exe) also supports scorch and treeclean.

tf vc help scorch:

Microsoft (R) TF - Team Foundation Version Control Tool, Version 15.129.28306.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Ensures that your local disk is identical to the server's view of the
working copy.

tf vc scorch [/diff] [/noprompt] [/preview] [/recursive] [/ignore] [/unmapped]
             [/exclude:itemspec1,itemspec2,...] [itemspec]

tf vc help reconcile:

Microsoft (R) TF - Team Foundation Version Control Tool, Version 15.129.28306.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Compares the current state of the workspace on disk with the server's view,
either to clean the workspace or to promote unpended local changes.

tf vc reconcile /clean [/diff] [/noprompt] [/preview] [/recursive] [/ignore]
                [/unmapped] [/exclude:itemspec1,itemspec2,...] [itemspec]

tf vc reconcile /promote [/adds] [/deletes] [/diff] [/noprompt] [/preview]
                [/recursive] [/noignore] [/exclude:itemspec1,itemspec2,...]
                [itemspec]

Upvotes: 1

nschonni
nschonni

Reputation: 4129

The TFS Power Tools (tfpt.exe) has a function called scorch that "Ensure source control and the local disk are identical". Here is a blog post that explains it a bit https://dennymichael.net/2013/03/19/tfs-scorch/. See this answer What is the difference between tfpt scorch and tfpt treeclean for the difference with the treeclean function

Upvotes: 4

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31023

An easy way is to create a new workspace, and perform Get latest from TFS. In this way, all files/folders in the new workspace are under source controlled.

Upvotes: 1

Related Questions