Friday 19 July 2019

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

I am using visual studio 2012 with Microsoft TFS 2012.
On the workspace that is created on my c: drive, a hidden folder $tf is created. I suspect TFS from creating this folder. It's lurking diskspace as the current size is several gigabytes now and it's about 25% diskspace of the total amount of gigabytes needed for the complete workspace. So this hidden $tf folder is quite huge.
The structure is like this:
c:\workspace\$tf\0\{many files with guid in filename}.gz
c:\workspace\$tf\1\{many files with guid in filename}.gz
Does anyone know if I can delete this $tf folder safely or if it is absolutely necessary to keep track of changes inside the workspace?

3 Answers

55
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

How to clear Windows File Cache?

http://technet.microsoft.com/en-us/sysinternals/bb897561.aspx


Team Foundation Server Power Tools December 2011

https://marketplace.visualstudio.com/items?itemName=MartinWoodward.TeamFoundationServerPowerToolsDecember2011

How to stream a video file to play on the browser, when the file exist in a different folder than the website?

How to stream a video file to play on the browser, when the file exist in a different folder than the website? RSS

3 replies

Last post Dec 05, 2013 11:09 AM by markfitzme
  • Robin2000Robin2000
    None
    0 Points
    5 Posts

    How to stream a video file to play on the browser, when the file exist in a different folder than...

    Dec 05, 2013 10:30 AM|LINK
    Hi,
    I have a website running on DNN7.1. We store all our documents, videos that we serve to the users (which are uploaded by users too) in different location than the website. Currently we are using HttpResponse's TransmitFile method to send files. It works fine for pdf, pngs etc. but for mp4 files we want to play it on the browser. I have created aspx page with html5 video element as shown below.

    <video class="something" width="320" height="240" controls>
    <source src="/FileServer.aspx?file=clips/vedio1.mp4" type="video/mp4">
    </video>
    video element uses FileServer.aspx, which is responsible to transmit the file. Code for FileServer.aspx page_load event handler is shown below (removed not needed code for readability).
    string fileName = Path.GetFileName(fileFullPath);
    string fileLength = new System.IO.FileInfo(fileFullPath).Length.ToString();
    string fileContentType = Utility.GetMIMEType(fileName);
    
    fileName = "\"" + System.Web.HttpUtility.HtmlEncode(fileName) + "\"";
    
    Response.Clear();
    Response.ContentType = fileContentType;
    Response.AddHeader("Content-Length", fileLength);
    Response.AddHeader("Content-Disposition", "inline; filename=" + fileName);
    Response.ContentEncoding = System.Text.Encoding.Default;
    
    Response.TransmitFile(fileFullPath);
    Response.End();
    Html5 video element appears on the browser fine and when I click it, it plays fine but I can't forward it or reverse the video. This will cause the video to stop and nothing else happens. I can only pause and play it. I am thinking TransmitFile method might not be suitable for my scenario. How do I acheive allowing forwarding and reversing the video using Response. I put the video under the website and used int the vidioe element (without FileServer.aspx) and all the video controls work fine. But I am not allowed to move the files to website folder, they will stay in a seperate folder or even seperate disk. How do I make playing video work for my scenario. Any help is greatly apprciated.

    Thanks,
    VIDEO ASP.NET MP4
  • AidyFAidyF
    All-Star
    37441 Points
    9076 Posts

    Re: How to stream a video file to play on the browser, when the file exist in a different folder...

    Dec 05, 2013 10:45 AM|LINK
    Easiest thing will be to find a client-side control (Flash, java etc) that does what you need to do.  Google for flash-based video players and see what is out there.
    VIDEO ASP.NET MP4
    I'm afraid I no longer use this forum due to the new point allocation system.
  • PatriceScPatriceSc
    All-Star
    44920 Points
    16038 Posts

    Re: How to stream a video file to play on the browser, when the file exist in a different folder...

    Dec 05, 2013 10:48 AM|LINK
    Hi,
    Good question. Not 100% sure by my approach would be first to play directly the video, use F12 Network tab to see http requests and play with the video (play, seek etc...). You should then be able to see what the browser sends to the server to get at a particular position. I would expect that the browser sends a particular header (range if I remember) to ask for a particular portion of the file.
    If confirmed you'll have then to handle this information and send back the relevant portion in your response.
    Depending on why you are not allowed to store the file on the server, another option could be perhaps to use a virtual folder pointing to a network location. The file is then technically speaking stored somewhere else while it is still directly reachable as an URL (and likely would be able to handle those byte-range requests...)


    VIDEO ASP.NET MP4
  • markfitzmemarkfitzme
    All-Star
    26061 Points
    5892 Posts

    Re: How to stream a video file to play on the browser, when the file exist in a different folder...

    Dec 05, 2013 11:09 AM|LINK
    What you describe is normal. To handle the other scenarios requires a streaming media environment. You just don't get that with transmit file, nor even with just standard video formats. That's why there are specialised streaming media servers to handle just this. I have yet to use it, but you may want to check out IIS's media services at: http://www.iis.net/media

Blog Archive