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
views:
77answers:
4I 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.
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...!!
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
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)) }