UpgradeTools/Get-BranchObjectsDifferentToBase.ps1

function Get-BranchObjectsDifferentToBase {
    Param(
        [Parameter(Mandatory=$false)]
        $BranchPath = (Get-TFSBranches | Out-GridView -OutputMode Single)
    )
    
    $BasePath = Get-BaseBranchForBranch -BranchPath $BranchPath

    Write-Host "Acquiring objects from $BranchPath" -ForegroundColor Green
    Write-Host "Base branch $BasePath" -ForegroundColor Green

    $Objects = Invoke-TFFolderDiff -SourceFolder $BasePath -TargetFolder $BranchPath
    $TempFolder = Create-TempDirectory
    $BaseFolder = Join-Path $TempFolder 'Base'
    $ModifiedFolder = Join-Path $TempFolder 'Modified'
    Create-EmptyDirectory $BaseFolder
    Create-EmptyDirectory $ModifiedFolder

    $CurrentObject = 0

    foreach ($Object in $Objects) {
        $CurrentObject++
        Write-Progress 'Downloading objects' -Status ('{0} of {1}' -f $CurrentObject, $Objects.Count) -PercentComplete ($CurrentObject / $Objects.Count * 100)
        Get-ObjectsFromTFSBranch -BranchPath (Join-Path $BranchPath $Object) -Type File -DestinationPath (Join-Path $ModifiedFolder $Object)
    }

    Write-Progress 'Downloading objects' -Completed

    $ModifiedFolder
}

Export-ModuleMember -Function Get-BranchObjectsDifferentToBase