Wednesday, June 18, 2014

Moving Multiple Files in Team Foundation Server 2013 Source Control

Moving Multiple Files in Team Foundation Server 2013 Source Control

My team was reorganizing some of our folders moved over from SVN into TFS today.  One of my teammates asked if he could move multiple files from a folder to another.  We wanted to preserve the history so hoping it was a new feature I told him to select all the files and do a move.  To my dismay this still is not possible in the Source Control Explorer GUI or Windows Explorer (Power Tools).  The Move option is grayed out.

The command line does allow for wildcards so this is what I will be telling our user base to use.  Sometimes this happens when a developer accidentally adds a bunch of files in the wrong folder.  There may be other files in the folder that need to remain so you can move the whole folder.

Checking the help this is now just an alias of rename:

C:\>tf.exe move /?
Microsoft (R) TF - Team Foundation Version Control Tool, Version 12.0.30501.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Changes the name or the path of a file or folder. You can use the rename
command or the alias move, to move a file or folder to a new location.

tf rename [/lock:(none|checkout|checkin)] [/login:username,[password]]
          olditem newitem

The wildcard way

It is short and sweet.  Just remember to add the path to the tf.exe to your PATH environment variable to make it easier to use in the future.  Something you can't do (and why would you) is move a parent folder into a child.

tf move "$/TeamProject/FolderA/*.dll" "$/TeamProject/FolderB/lib"


Vote

Please vote this up so Microsoft gets it in soon.

No comments:

Post a Comment