title: How to add columns into multiple CSV files in a single directory without adding quotation marks?
body: <p>I have thousands of CSV files in a single directory. I'm looking for a way how to add 2 columns (including headers) to each file.</p>
  
  <p>There are some conditions:</p>
  
  <ol>
  <li><p>There is always 0 value in column #5</p></li>
  <li><p>In column #6 I want to store file name without extension (ABC)</p></li>
  </ol>
  
  <p>INPUT FILE EXAMPLE (FILENAME IS ABC.CSV)</p>
  
  <pre><code>HEADER1,HEADER2,HEADER3,HEADER4
  04/22/2012,47.64,47.97,47.05
  04/23/2012,47.6,48.2,47.4
  04/24/2012,48.13,48.33,47.84
  04/25/2012,47.81,48.14,47.59
  04/26/2012,47.83,48.21,47.49
  04/27/2012,47.2,47.31,46.84
  04/28/2012,47.01,47.05,46.33
  </code></pre>
  
  <p>The code I've posted below has 1 problem,</p>
  
  <ol>
  <li>It adds  quotation marks ("04/22/2012","47.64","47.97","47.05","0","ABC") to every value in a new file.</li>
  </ol>
  
  <p>OUTPUT FILE EXAMPLE I NEED</p>
  
  <pre><code>HEADER1,HEADER2,HEADER3,HEADER4,HEADER5,HEADER6
  04/22/2012,47.64,47.97,47.05,0,ABC
  04/23/2012,47.6,48.2,47.4,0,ABC
  04/24/2012,48.13,48.33,47.84,0,ABC
  04/25/2012,47.81,48.14,47.59,0,ABC
  04/26/2012,47.83,48.21,47.49,0,ABC    
  04/27/2012,47.2,47.31,46.84,0,ABC
  04/28/2012,47.01,47.05,46.33,0,ABC
  
  
  
  
  $files = Get-ChildItem ".\" -filter "*.csv"
  
  for ($i=0; $i -lt $files.Count; $i++) {
  $outfile = $files[$i].FullName + "out" 
  $csv = Import-Csv $files[$i].FullName 
  $newcsv = @()
  foreach ( $row in $csv ) {
      $row | Add-Member -MemberType NoteProperty -Name 'HEADER 5' -Value '0'
      $row | Add-Member -MemberType NoteProperty -Name 'HEADER 6' -Value   $files[$i].BaseName
      $newcsv += $row
  }
  $newcsv | Export-Csv $files[$i].FullName -NoTypeInformation
  }
  </code></pre>
  
  <p>And one more question. Because I have thousands of files in a directory, is this code efficient enough to do a task as fast as possible?</p>
  
  <p>Somebody has already suggested me to improve code by Instead of looping thru the rows consider building te members with select</p>
  
  <pre><code>$csv = $csv | select-object *,@{n="HEADER5";e={0}},@{n="HEADER6";e={$file.BaseName}}
  </code></pre>
  
  <p>But I don't know how to implement his suggestion into my code.</p>