从TFS销毁已删除的文件/文件夹

时间:2013-01-17 15:10:25

标签: powershell tfs tf-cli

如何销毁所有TFS文件和文件夹?

1 个答案:

答案 0 :(得分:2)

使用以下Powershell + TF.exe脚本销毁TFS中所有已删除的文件和文件夹

$tfsServer = Get-TfsServer -name http://YOURTFSSERVER:PORT    
$destroyList = get-tfschilditem -item $/Root/ -server $tfsServer -Deleted -recurse | Where {$_.DeletionId -ne 0} 
foreach($item in $destroyList)
{
    $itemPath = '"' + $item.ServerItem + ";X" + $item.DeletionId + '"'
    tf destroy $itemPath /i /startcleanup
}