Here is a quick script to find a certain file or file type. Get latest on it and then mark it for delete. You will need to review your pending changes to make sure the correct files are being deleted and then manual check the change in. Enjoy! I am still playing around with code snippets in my blog so I apologize for word wraps and other bad formatting.
#Script to Find and delete files based on their extension
#You must be in your local workspace folder when executing this script
if ((Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue
}
$tfs=Get-TFSServer http://tfs.yourdomain.com/tfs/yourcollection
$TFSToolsPath = "${Env:PROGRAMFILES(x86)}\Microsoft Visual Studio 12.0\Common7\IDE"
Write-Host $TFSToolsPath
$CleanUpList = Get-TfsChildItem -Server $tfs -Recurse $/yourteamproject/*.suo
foreach($file in $CleanUpList){
Write-Host $file.ServerItem -ForegroundColor Cyan
#Get Latest On Each Item
tf get $file.ServerItem
#Delete Each item
tf delete /lock:checkout $file.ServerItem
}
No comments:
Post a Comment