version-controltfsfile-recoveryundelete

Recover deleted file in the tfs


I have a huge repository. A while ago a file with the name FooBar.xml was deleted from some unknown directory in the tfs. What would be the easiest way to find the file? There are thousands of directories in the repository, so manually inspecting each and every one looking for deleted files is not a feasible option.


Solution

  • From a Visual Studio Command Prompt use the command

    tf undelete $/TeamProject/FooBar.xml /noget /recursive

    This will undelete any files in the repository with the name FooBar.xml, and leave the undeletes as pending changes. If you can narrow it down to a particular branch or area of your repository that will speed things up.

    You can then go though the list of pending undeletes, identify the file you want to keep and "undo" the other pending changes.