functions/common/Get-CommonRootPath.ps1
function Get-CommonRootPath { param([string[]]$Paths) if ($Paths.Count -eq 0) { return '' } $root = $Paths[0] foreach ($p in $Paths) { while (-not $p.StartsWith($root, [System.StringComparison]::OrdinalIgnoreCase)) { $root = Split-Path -Path $root if (-not $root) { return '' } } } return $root } |