Moving multiple files in TFS Source Control

Version ControlTfs

Version Control Problem Overview


I'm using Team Foundation Server 2008 (SP 1) and I need to move multiple files from one folder to another (to retain file history). In addition to Team Explorer (with SP 1) I've also got the latest TFS Power Tools (October 2008) installed (for Windows Shell integration).

Now, the problem is that I can't seem to select and move multiple files via either the shell or the Source Control Explorer window. I can move individual files (by right clicking + "Move") and I can move whole folders (same operation) but when I select multiple files (in a folder) the "Move" context item is grayed/disabled.

Does anyone know if this is possible.. and if not.. why not!?

Can anyone suggest a workaround which isn't overly complicated?

Please vote up here: https://connect.microsoft.com/VisualStudio/feedback/details/715041/support-moving-multiple-files-in-tfs-source-control-explorer and here http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2271540-allow-to-move-more-than-one-file-at-once-in-tfs-so

enter image description here

enter image description here

Version Control Solutions


Solution 1 - Version Control

Use the tf.exe tool from the Visual studio commandline - it can handle wildcards:

tf.exe move <olditem> <newitem>

Example:

tf.exe move "$/My Project/V*" "$/My Project/Archive"

[EDIT] As noted in the comments: move is an alias for rename. Both commands move history.

Solution 2 - Version Control

Use rename instead of move

tf.exe rename "$/PROJECT/SharedLibs/Log4Net/*.*" "$/PROJECT/SharedLibs/3rdParty/"
tf.exe rename "$/PROJECT/SharedLibs/ZipLib/*.*" "$/PROJECT/SharedLibs/3rdParty/"

Check it out the help documentation: TFS Command Line Reference

Solution 3 - Version Control

Holan Jan has written a Visual Studio Extension which provides 'move' for multiple files within source control explorer (i.e. using a GUI) Works a treat, also has support for recent versions.

for VS2022 : https://marketplace.visualstudio.com/items?itemName=HolanJan.TFSSourceControlExplorerExtension-2022

for VS2019 : https://marketplace.visualstudio.com/items?itemName=HolanJan.TFSSourceControlExplorerExtension-2019

for VS2017 : https://marketplace.visualstudio.com/items?itemName=HolanJan.TFSSourceControlExplorerExtension-18397

for VS2015 : https://marketplace.visualstudio.com/items?itemName=HolanJan.TFSSourceControlExplorerExtension-13343

for VS2013 : https://marketplace.visualstudio.com/items?itemName=HolanJan.TFSSourceControlExplorerExtension-11508

for VS2012 : https://marketplace.visualstudio.com/items?itemName=HolanJan.TFSSourceControlExplorerExtension-8896

Under the hood it does use the same commands mentioned above but it's just a bit friendlier to use. Each of the versions listed require RTM version of Visual Studio.

Solution 4 - Version Control

Stick all the files that you wish to move, under a folder and then move that folder.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRobSView Question on Stackoverflow
Solution 1 - Version ControlKurt SchelfthoutView Answer on Stackoverflow
Solution 2 - Version ControlTitwanView Answer on Stackoverflow
Solution 3 - Version ControlSid JamesView Answer on Stackoverflow
Solution 4 - Version ControlMerrick ChafferView Answer on Stackoverflow