I don’t know why it never occurred to me before to use a wildcard to move files in TFS but it didn’t. Now I hardly ever have to move files around in the source repository but the occasion has occurred a few times. The first time I moved each file individually…what a pain; luckily there weren’t very many files. Now I know I can use the wildcard feature which is not listed in the command documentation but is very handy.
This is not available in the Team Explorer client, you need to use the TF.EXE command line utility found in the Visual Studio install directory under Common7\IDE\TF.EXE on my box it looks like:
C:\>cd Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE
Now if you check the parameters available for the move command (alias of the rename command) you will find that it’s very straightforward, but no mention of a (*) wildcard.
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE>tf move /?
TF - Team Foundation Version Control Tool
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)] olditem newitem
You can execute the command with a wildcard by entering something similar to:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE>tf move "$/source /old location/*" "$/source/new location/*"
This of course has been a huge time saver and keeps me from beating my head against the desk. An easy and very obvious use of the command that I missed the first time around, so I thought I’d pass it along just in case you might have missed it too.
A word of caution: The wildcard works equally well for folder as it does for files.