views:

88

answers:

1

Can i use powershell script to copy a set of files from a folder to Clear Case..?? i have the task of synchronising files from TFS to Clear Case.. like i need to take a set of files aftr a certain date from tfs server and synchronise these files to Clear case..

+1  A: 

I have written PowerShell scripts before to migrate code (permanently/one-time) from a different SCCS product (SoftbenchCM) to TFS. Basically, you need to configure a clean workspace & workfolder mapping for TFS and setup a view/configspec for ClearCase. On some periodic basis, from a Visual Studio 2005/2008/2010 prompt do a:

$results = tf get C:\<workfolder_root> "/v:D01/01/2010" /r
if ($LastExitCode -ne 0) throw "tf get failed with $LastExitCode"

Note that you can substitute for 01/01/2010 using [DateTime], Get-Date or any string that .NET can parse as a DateTime. Then parse through the $results to find the files that have been updated. Cycle through the updated files and use "cleartool checkout path_under_CC_view" to check out the corresponding file, copy over it from the TFS dir to the CC view dir. Then use cleartool checkin to checkin the file under ClearCase. Note that is is just one-way sync. You might want to lock users from updating these files on ClearCase so their changes don't get overwritten when you sync from TFS.

Keith Hill