title: Merge CSV files in subfolders
body: <p>I have found a script which does everything that I need, but it's only useful if you run it in a single folder. What I'd like is:</p>
  <p>Script is located in c:/temp/. Upon running the script, it would go into each subfolder and execute. Each subfolder would then have a separate Final.csv.</p>
  <p>Somebody mentioned just add -Recurse, but it doesn't complete the job as described. With -Recurse added, it goes into each subfolder and creates a Final.csv final in the root dir (C:/temp/) instead of creating a Final.csv in each subfolder.</p>
  <pre><code>$getFirstLine = $true
  
  get-childItem *.csv | foreach {
      $filePath = $_
  
      $lines = Get-Content $filePath  
      $linesToWrite = switch($getFirstLine) {
             $true  {$lines}
             $false {$lines | Select -Skip 2}
  
      }
  
      $getFirstLine = $false
      Add-Content Final.csv $linesToWrite
      } 
  </code></pre>