TFS creates a $tf folder with gigabytes of .gz files. Can I safely delete it?

TFS keeps a hash and some additional information on all file in the workspace so that it can do change tracking for Local Workspaces and quickly detect the changes in the files. It also contains the compressed baseline for your files. Binary files and already compressed files will clog up quite a bit of space. Simple .cs files should stay very small (depending on your FAT/NTFS cluster size).

If you want to get rid of these, then set the Workspace type to a server workspace, but lose the advantages of local workspaces.

Deleting these files will be only temporarily since TFS will force their recreation as soon as you perform a Get operation.

You can reduce the size of this folder by doing a few things:

  • Create small, targeted workspaces (only grab the items you need to do the changes you need to make)
  • Cloak folders, exclude folders containing items you don’t need. Especially folders containing lots of large binary files
  • Put your dependencies in NuGet packages instead of checking them into source control..
  • Put your TFS workspace on a drive with a small NTFS/FAT cluster size (a cluster size of 64Kb will seriously enlarge the amount of disk space required if all you have are 1KB files.

To setup a server workspace, change the setting hidden in the advanced workspace setting section:
enter image description here

Leave a Comment

tech