Geeks With Blogs


View Tarun Arora's profile on LinkedIn

profile for Tarun Arora at Stack Overflow, Q&A for professional and enthusiast programmers

Tarun Arora - Visual Studio ALM MVP ALM, Agile, Automation, Performance Testing, Software QA, Cloud, ...

At some point in the project lifecycle, one has to perform certain housekeeping activities in the version control, it might be restructuring folders or simply moving files into directories… The move command in the visual studio source control explorer proves to be of great help! However, with the Move command only allows you to move just one file or folder at a time. It more than often that we need to move multiple files at once.

A quick look at how this works at present… (valid for both VS 2010 and VS 2012 RC)


Figure 1- Move command enabled for only one folder


Figure 2- Move command disabled if more than one file/folder selected

What do you do?

You turn to the power of command line Open-mouthed smile

Use the tf.exe tool from the Visual studio commandline - it can handle wildcards (valid for both VS 2010 and VS 2012 RC)

tf.exe move <olditem> <newitem>

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

1. Open up command prompt


2. Change directory to the workspace where you would like to perform this operation. This is the step most where most people go wrong!


3. Run the following command tf.exe move (in case you get a message that the tf.exe is not a recognized command) you can also run the command like C:\ProgramFiles (x86)\Microsoft Visual Studio 10.0\Common7\IDE\tf.exe move. See the example below


4. So if I wanted to move all docx files from $\Playpit to $\Playpit\BuildNotes you will run the following command…



NOTE – Files in $\Playpit of type *.docx that are not in your workspace did not be moved.  Only the *.docx files that were in the workspace got moved from $\Playpit to $\Playpit\BuildNotes. Just a reminder, make sure, you do a full workspace get latest to ensure all the files that you intend to move are picked up.


Perform a get latest on the workspace and re-run the move command,


Voila job done!


Hope this helps, just one more way to be more productive In love

Posted on Saturday, July 21, 2012 1:27 PM Power Tools | Back to top

Comments on this post: Visual Studio Tip Move Multiple Files using Move command

comments powered by Disqus

Copyright © Tarun Arora [Microsoft MVP] | Powered by: