144

I'm part of a large project mapped from TFS, within that project there is a folder which I have finished working on. I don't want that folder anymore so I'd like to delete my local copy. The problem is that TFS wants to mirror the change and delete the folder from source control, I don't want to remove it from TFS.

The only way I can find to do this is to unmap the workspace, and then go through and get all the other folders I need to work on.

Is there anyway I can just delete that folder locally?

2
  • Can you give some more info such as Which version of TFS and which version of Visual Studio you are using? Are you using Server or local workspaces?
    – James Reed
    Nov 5, 2013 at 15:55
  • @JamesReed VS2008 with compatibility patch, VS2010 and VS2012. TFS 2012. Local workspaces (separate workspaces per visual studio version)
    – James
    Nov 6, 2013 at 10:42

2 Answers 2

312

This is an older post, but since the only given answer seems "not entirely correct" to me I'd like to answer anyway: I blogged about this (in german) here: blog.nils-andresen.de

If you have a local copy, that you want to un-get or un-download like this:

enter image description here

simply right-click the folder and then click "Get Specific Version" or "Advanced > Get Specific Version" and specify Changeset 1.

Here's why from Martin Woodward's TFS Top Tips:

...if you do a "Get Specific Version..." on the files, and select Changeset 1, the files will be deleted locally and the server will know this. The color of the file in the Source Control explorer will go from black to gray and will have the phrase "Not downloaded" in the latest column.

Changeset 1 is a special changeset on your Team Foundation Server instance. It was created as part of the setup routine and only contains one thing - the root node ($/) in your source control tree. If you do a get for Changeset 1 on any actual files then they will not exist at that point in time on the system so will be deleted locally and the server will know this.

Get Specific Version - dialog

When the process is complete the "Latest"-column will show "not downloaded".

enter image description here

After that any remaining files in the filesystem can safely be removed.

13
  • 5
    Cloaking worked fairly well, but I had more success with this method and it's simpler. Aug 26, 2014 at 17:06
  • 5
    I much prefer this approach. This doesn't require me to remember about "cloak" and "activate" at the future time when I might need that project again. I can just get the latest version and I'm good to go.
    – undetected
    Oct 22, 2014 at 15:43
  • 8
    Looks like a good hack. Why MS is not building intuitive UIs? like simple command "Remove local copy", and my favorite "Advanced > Get Specific Version". Since when "Get Specific Version" is advanced thing? they must have super dumb developers in house if this is Advanced to them. Anyway thank you for this answer (I can't stand TFS [svn/git user here]) Jan 14, 2016 at 20:01
  • 7
    This also works if you have already deleted the local folder and are trying to clean up the mess you made.
    – Hutch
    Jul 14, 2017 at 23:28
  • 3
    Command line equivalent: tf vc get <itemspec> /version:c1 /recursive /overwrite /force
    – Brain2000
    Sep 26, 2018 at 21:38
10

You can cloak the folder in your local workspace.

By setting the working folder status to Cloaked, you can specify that a local folder should not copy files from the server when you perform a Get operation. You might choose to do this to conserve space on your local disk. If you later decide that you need to get files in those cloaked folders, you must change the status to Active and then perform a Get operation.

4
  • 5
    Just to add to this. To get back to original state of Mapped but without a get (grey in source control explorer) delete anything left over from the cloak and then uncloak. TFS will ask if you want to perform a get now. Click no.
    – James
    Nov 25, 2013 at 10:32
  • 5
    I went with cloaking instead of undownloading. I'm used to doing "Get Latest" on the top level, and cloaking prevents re-downloading of specific folders when doing so.
    – Rudey
    Dec 4, 2015 at 14:53
  • This works! Accepted answer didnt work for me (because I was removing a branch and its first changeset was not 1). Thanks!
    – birgersp
    Mar 19, 2021 at 6:52
  • This should be the accepted answer, edited with the addition of @JamesBarrass. It works fast and doesn't feel like a hack.
    – Brecht
    Jan 25 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.