Код:

$sRootFolder = 'C:\Мои проекты\0203'
if([System.IO.Directory]::Exists($sRootFolder)) {
Get-ChildItem -Path $sRootFolder -Directory |`
ForEach-Object -Process {
Get-ChildItem -Path $_.FullName -File -Recurse -Include "*.csv" |`
ForEach-Object -Begin {
$oFileInfo = $null
} -Process {
if($_.Length -ge $oFileInfo.Length) {
$oFileInfo = $_
}
} -End {
$oFileInfo
}
} | ForEach-Object -Begin {
$aContent = @()
} -Process {
$aCurrContent = [System.IO.File]::ReadAllLines($_.FullName)
if($aContent.Count -eq 0) {
$aContent += $aCurrContent
} else {
$aContent += $aCurrContent[1..$($aCurrContent.Count - 1)]
}
} -End {
[System.IO.File]::WriteAllText("$sRootFolder\$(([System.IO.DirectoryInfo]::new($sRootFolder).BaseName)).csv", [System.String]::Join("`n", $aContent))
}
} else {
Write-Host "Can't find root folder [$sRootFolder]." -ForegroundColor Red
}