none
Question on moving folders in TFS Source Control

    Question

  • Hello:

     

    I am evaluating TFS, and I am experimenting with different ways to organize my source code.  Is there a way to move more than one folder at a time?  I want to take a group of folders and move them all underneath a new folder.  If you multi-select folders in the IDE, the move option becomes disabled.

     

    Is there a way to accomplish this from the command line?  Is there a .net API that I could use to accomplish this from PowerShell?

     

     

     

     

    Monday, July 16, 2007 6:12 PM

Answers

  • You can use 'tf rename' from the command line.  Or in PowerShell, it would be something like
    > $ws = get-workspace
    > $ws.PendRename("foo", "bar\foo")

    In both cases you can only do 1 rename per server call, though.  And the speed of each operation slows down pretty quickly if you have lots of pending renames in your workspace.  Hopefully that's good enough for your case.
    Monday, July 16, 2007 8:51 PM

All replies

  • You can use 'tf rename' from the command line.  Or in PowerShell, it would be something like
    > $ws = get-workspace
    > $ws.PendRename("foo", "bar\foo")

    In both cases you can only do 1 rename per server call, though.  And the speed of each operation slows down pretty quickly if you have lots of pending renames in your workspace.  Hopefully that's good enough for your case.
    Monday, July 16, 2007 8:51 PM
  • Thank you, Richard. 

     

    I hadn't thought of using the rename command -- I had looked for a "move".  I appreciate your help!

    Tuesday, July 17, 2007 4:04 PM
  • If it matters, 'tf move' is an alias for 'tf rename'.
    Tuesday, July 17, 2007 5:46 PM
  • Richard,

    I need to move (rename) at the folder/branch level also.  I've tried the move IDE command and the tr rename command line function, both without success (see 1. and 2.):

    1. The IDE command, when applied to individual files, or folders, gives the error "Source control folder is not mapped to a local folder".  The IDE reports the correct mapping and the latest file versions have been pulled.

    2. the "tf rename $/TFProject/folder1/Default.aspx /$TFProject/folder2/Default.aspx" command gives the error "Unable to determine the workspace".

    Thoughts?

    THX
    Curt Zarger
    Wednesday, July 18, 2007 12:26 PM
  • 1. Make sure the target (folder2) is also mapped.

    2. Make sure you run the command from inside the workspace where you want to pend the rename.  Also, you have a typo in the target path - /$TFProject should be $/TFProject.
    Thursday, July 19, 2007 3:38 PM