How to: Move, Rename, and Delete Source-Controlled Files and Folders

Files and folders under source control can be easily moved, renamed, and deleted from Source Control Explorer. For more information, see Using Source Control Explorer. Files and folder items can also be renamed and deleted from the command line. In order to simultaneously remove or delete multiple source-controlled files, you must use the command line. In the Source Control Explorer, you can only move, delete or remove one file or folder at a time. For more information, see Rename Command (Team Foundation Source Control) and Delete Command (Team Foundation Source Control).

Note

Tf.exe move is an alias for Tf.exe rename.

The following procedures demonstrate moving, renaming, and deleting file and folder items under source control from Source Control Explorer.

Required Permissions

To perform these procedures, you must have the Check out permission set to Allow. For more information, see Team Foundation Server Permissions.

To move source controlled folders and files

  1. On the View menu, choose Other Windows, and then select Source Control Explorer.

  2. Make sure that Workspace drop-down list at the top of the Source Control Explorer has the workspace selected where the item that you want to move is mapped.

  3. In the right pane of Source Control Explorer, locate the project in the workspace from which you want to move a folder or file.

  4. In the right pane of Source Control Explorer, right-click the specific folder or file that you want to move, and click Move.

  5. In the Move dialog box, either manually type the destination for the item in the To textbox, or Browse to use the Browse for Folder dialog box, and then click OK.

To Rename source controlled folders and files

  1. On the View menu, choose Other Windows, and then Source Control Explorer.

  2. Make sure that Workspace drop-down list at the top of the Source Control Explorer has the workspace selected where the item that you want to move is mapped.

  3. In the right pane of Source Control Explorer, locate the project in the workspace from which you want to move a folder or file.

  4. In the right pane of Source Control Explorer, right-click the specific folder or file you want to move and choose Rename.

  5. Type the desired name for the file or folder.

    You can rename an item that has a pending add but has not been checked in; however, you cannot rename an item that has been branched but not yet checked in or a conflict occurs. For more information, see Resolving Conflicts (Team Foundation Source Control). When you rename a file that has pending changes, the edits are preserved. If you rename a file for which a pending rename has been recorded, the initial rename change is replaced by the second rename change.

    Note

    Source control items can also be renamed from the command line. For more information, see Rename Command (Team Foundation Source Control).

To delete source controlled folders and files

  1. On the View menu, choose Other Windows and then Source Control Explorer.

  2. Make sure that Workspace drop-down list at the top of the Source Control Explorer has the workspace selected where the item that you want to move is mapped.

  3. In the right pane of Source Control Explorer, locate the project in the workspace from which you want to move a folder or file.

  4. In the right pane of Source Control Explorer, right-click the specific folder or file that you want to move and choose Delete.

    Note

    You cannot delete an item for which another pending change exists. For example, a checked out file cannot be deleted.

    An icon that indicates the item is deleted will appear to the left and the status delete will appear under the Pending Change column. The item is deleted the next time that a check-in is performed. For more information, see Pending Checkins Window.

    Note

    Source control items can also be deleted from the command line. For more information, see Delete Command (Team Foundation Source Control).

See Also

Reference

Rename Command (Team Foundation Source Control)
Delete Command (Team Foundation Source Control)
Undelete Command

Concepts

Using Source Control Explorer

Other Resources

Working with Source Control Files and Folders