tags:

views:

77

answers:

4
PS> C:\Windows\System32> Get-TfsItemProperty $/MyFirstTFSProj -r `
    -server xyzc011b| Where {$_.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
A: 

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.

Keith Hill
A: 

PS C:\Windows\System32> cd d:\test PS D:\Test> tf get . /r "/v:D$((Get-Date).AddDays(-150))" The term 'tf' is not recognized as a cmdlet, function, operable program, or scr ipt file. Verify the term and try again. At line:1 char:3 + tf <<<< get . /r "/v:D$((Get-Date).AddDays(-150))"

Keith i tried to run the code given by you ...but the above error is coming...!!

deep
Try it from a Visual Studio 2008 command prompt (Start -> Run -> Microsoft Visual Studio 2008 -> Visual Studio Tools). That will have the path set correctly. FYI tf.exe is located in VS's Common7\Ide folder.
Keith Hill
A: 
 D:\xyz>tf get . /r "/v:D$((Get-Date).AddDays(-30))"

TF10145: The version specification is not in a supported date or time format.

Keith ...above error is coming while running the code given by u in Visual Studio 2008 command prompt ..FYI i need a code for powershell prompt

deep
Please edit your original question with new information. This is not a discussion forum. We do not "reply to the thread" here. See the FAQ at http://stackoverflow.com/faq.
John Saunders
A: 

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)) }

deep