开发者

How to to copy all the files available in my TFS source server to a folder in a directory?

I want to copy all the files available in my TFS source server to a folder in a directory. I tried the below code but error is coming while achieving the same. Can you suggest a solution?

PS> C:\Windows\System32> Get-TfsItemProperty $/MyFirstTFSProj -r `
    -server xyzc011b| W开发者_StackOverflowhere {$_.CheckinDate -gt (Get-Date).AddDays(-150)} |
    Copy-Item  D:\john\application1 -Destination C:\Test -whatif

Copy-Item : The input object cannot be bound to any parameters for the command
either because the command does not take pipeline input or the input and its pr
operties do not match any of the parameters that take pipeline input.
At line:2 char:14
+     Copy-Item  <<<<  D:\Deepu\SilverlightApplication5 -Destination C:\Test -w
hatif


I would just create a workspace/workfolder mapping and use the tf.exe tool to get the files at the date you interested in e.g.:

PS\> cd <root_of_workfolder_on_local_harddrive>
PS\> tf get . /r "/v:D$((Get-Date).AddDays(-150))"

If this isn't the final destination then just copy the dir contents to the destination. If you don't need the workspace any longer, then delete it.

BTW I use the PowerTool cmdlet quite a bit but find it primarily useful for queries. For instance, AFAICT, there is no equivalent of "tf get" which you need to pull down the files from the server. IOW, you can't use copy-item to copy the files from the TF server. You have to use a tf command to retrieve the file from the server.


ANSWER ACHIEVED FOR MY QUESTION

I am posting final answer.With the help of this script we can copy all the file from a TFS server and copy all the checked in files from a particular date to the local hard drive while maintaining the hierarchy at the same time. Enjoy..!!

Get-TfsChildItem $/MyFirstSpectaProj -r -server xyz10co553 |
? { $_.CheckinDate -gt (Get-Date).AddDays(-01) } | % { $_.DownloadFile(@(join-path C:\test\xyz $_.ServerItem)) }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜