Mémo pour fusionner 2+ fichiers csv en ne gardant qu’une ligne d’en-tête.
Source : http://stackoverflow.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$getFirstLine = $true get-childItem "YOUR_DIRECTORY\*.txt" | foreach { $filePath = $_ $lines = $lines = Get-Content $filePath $linesToWrite = switch($getFirstLine) { $true {$lines} $false {$lines | Select -Skip 1} } $getFirstLine = $false Add-Content "YOUR_DESTINATION_FILE" $linesToWrite } |