SHARE
TWEET

Move a group of folders in TFS Source control using Powershe

jamiet Mar 27th, 2013 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #
  2. # This script will move all the named folders into an archive folder. However, it won't just move the folders, it will move them in TFS as well.
  3. #
  4. # It doesn't do the commit for you - safer to let you do that.
  5. #
  6. # Jamie Thomson, 2013-03-27
  7. #
  8. param($root='c:\tfs\SomeFolder\')
  9. $TfExePath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 10.0\Common7\IDE\TF.exe"
  10. $Now = Get-Date -Format "yyyyMMddTHHmmss"
  11. $ArchiveFolder = "$root" + "Archive_" + "$Now"
  12. #mkdir $ArchiveFolder
  13. $folders = ("Folder1","Folder1","Folder1")
  14. foreach ($folder in $folders)
  15. {
  16.     Write-Host "Folder=$folder"
  17.     $Source = "$root" + $folder
  18.     $Target = $ArchiveFolder + "\" + $folder
  19.     & $TfExePath move $Source $Target
  20. }
  21. #cd c:\tfs\ASOS.BI\Cleanup\ODS\
  22. #tf
  23.  
  24. #
  25. # This was a handy blog psot that helped when writing this:
  26. #  http://stackoverflow.com/questions/8228729/expand-output-of-tf-exe-results-from-powershell
  27. #
  28. #
RAW Paste Data
Top