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?

James
  • 9,774
  • 5
  • 34
  • 58
  • 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 05 '13 at 15:55
  • @JamesReed VS2008 with compatibility patch, VS2010 and VS2012. TFS 2012. Local workspaces (separate workspaces per visual studio version) – James Nov 06 '13 at 10:42

2 Answers2

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.

Community
  • 1
  • 1
Nils
  • 9,682
  • 6
  • 46
  • 72
  • 5
    Cloaking worked fairly well, but I had more success with this method and it's simpler. – Nelson Rothermel Aug 26 '14 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 '14 at 15:43
  • 1
    This was just what I was looking for. I can inform that this still works if you have already deleted the local files from your filesystem. – einarnot Jan 05 '16 at 09:46
  • 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]) – Pawel Cioch Jan 14 '16 at 20:01
  • this didn't work for me, it showed as deleted and wanted me to check it in. i just ended up purging all MRU locations so i never accidentally open it – Chris Marisic Jan 29 '16 at 15:30
  • Worked for me in VS2015 / TFS2013 On Premise. – Vincent Vancalbergh Feb 06 '17 at 12:30
  • 1
    This worked for me because I was getting a warning that I should remove items from the local workspace. After I did this for a few directories, the warning went away. TF401190: The local workspace {name} has {amoung} items in it, which exceeds the recommended limit of 100000 items. To improve performance, either reduce the number of items in the workspace, or convert the workspace to a server workspace. – jaycer Mar 30 '17 at 15:47
  • 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 '17 at 23:28
  • 1
    Thanks for this! Certainly did the trick for me. Just as a note for clarity, I found the "get the changeset No. 1 *for that folder*" to be a little confusing. I first of all ended up trying "the first" changeset that there was for that folder; to no avail. After scratching my head and Googling again, I found a blog post elsewhere that said "Use changeset 1 - it's a special changeset..."; it all made sense now. I'll put this and a link in the answer, just to make it unambiguous for others. – Geoff James Feb 01 '18 at 09:31
  • 3
    Command line equivalent: tf vc get /version:c1 /recursive /overwrite /force – Brain2000 Sep 26 '18 at 21:38
  • 3
    Redonkulous that "Changeset 1" means "Delete local copy and tell yourself the local copy is deleted." So obscure -- how much labor and productivity has been wasted trying to figure out TFS "features"? – jaycer Feb 01 '19 at 16:28
  • 1
    As @JoeBauer said, this worked a treat for me in 2021. – DeVil Jun 23 '21 at 03:18
  • 1
    I too prefer this to cloaking. Vielen Dank! – David Dec 07 '21 at 15:06
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.

Eric Johnson
  • 1,377
  • 7
  • 6
  • 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 '13 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 04 '15 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 '21 at 06: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 '23 at 07:57