I'm writing a powershell script for deployment. I need to copy changed files from TFS to our Test Server. I have been able to retrieve the change sets, and I have been able to drill down to the Item. I have access to the path of the source file.
Does anyone know an efficiect way of doing this? Do I need to use the DownloadFile
cmdlet or can I just use the Copy-Item
cmdlet.
path of sourcefile is $file.ServerItem
which resolves to, for example, $/Project/PromonetBaseline/Main/Source/ItemHierarchy.vb
Destination is a path like \\104Server\WebApps\PromonetBaseline\Main\Source\ItemHierarchy.vb
Is there a neat way to do this programatically?
Any input is appreciated.
Thanks, Akin
For something like this, I would set up a local workfold mapping for the source files, get those files and then use Copy-Item
to copy the source files to the destination folder. You can use the -Force
parameter on Copy-Item
to overwrite an existing file.
Another option is to use tf view itemspec /i > tempfilename
to get the files from the server without creating a local workfold mapping.