Search code examples
azuretfsazure-devopstfvc

How do you permanently delete a folder inside an Azure VSTS project?


I have folders within both Azures VSTS (a TFVC repository) and TFS that I needed to permanently delete. On TFS this was quite easily done using the tf destroy $/<MyProject>/<Folder_To_Delete> command in a command window on the server on which the TFS is running. The web page in learn.microsoft.com that describes the "tf destroy" command (Https:// learn.microsoft.com/en-us/vsts/tfvc/destroy-command-team-foundation-version-control) shows that this command is also available for VSTS however I have been unable to get the command to work within a Developer Command Prompt window running on my local box.

tf destroy $/<MyProject>/<Folder_To_Delete> /collection:https://<MyTeamService>.visualstudio.com/<MyProject> /login:<userid>,<password>

The error I receive back is

TF31002: Unable to connect to this Team Foundation Server:

Team Foundation Server Url:

Possible reasons for failure include:

- The name, port number, or protocol for the Team Foundation Server is incorrect.

- The Team Foundation Server is offline.

- The password has expired or is incorrect.

Technical information (for administrator):

The remote server returned an error: (404) Not Found.

However if I put the URL into a browser my VSTS instance shows up. So the 404 looks to me like azure is blocking outside efforts to permanently delete on VSTS. I have logged onto the Azure portal expecting to find something like the Advanced tools option you would find on Web App Services, But the Team Services / Team Projects has nothing like this. Can someone explain to me how to properly execute the "tf destroy" command on Azure Team Services? Or does Azures VSTS just lack the support to permanently delete individual folders and files?


Solution

  • The tf destroy command requires a collection URL. In VSTS, there is no concept of a collection, only team projects. All team projects are created under the Default Collection.

    To use the tf destroy command with VSTS, your collection URL must be in the following format: https://accountname.visualstudio.com/DefaultCollection

    By putting a collection URL of https://accountname.visualstudio.com/Project Name, the command was looking for a collection called Project Name in the VSTS account, which does not exist.

    This command works: Open a Developer Command Prompt in administrator mode and issue the following command and supply your credentials. tf destroy $/Project Name/Folder To Delete /collection:https://accountname.visualstudio.com/DefaultCollection