Search code examples
tfsdetectdelete-file

How to programmatically detect deleted files?


In Team Foundation, you can ask Team Explorer to show deleted files by doing this:

Tools > Options > Source Control > Visual Team Foundation Server > Show deleted items in the Source Control Explorer.

My question is how do you do the same thing programmatically?

I am developing a synchronisation tool, and I need to detected deleted files in TFS. Workspace.Get(...) returns only non-deleted files.

Any idea how I can achieve that?


Solution

  • Go to the Visual Studio folder in your start menu and start up a Visual Studio Command Prompt from the "Visual Studio Tools" subfolder.

    The command you want to run is:

    tf dir /server:myserver $/myproject /recursive /deleted
    

    (where myserver and myproject are your server and project)

    use "tf help" for general info, "tfs help dir" for more help on this command, or google on "tf.exe" for more info.