title: Export-CSV with the path as a variable
body: <p>I have a script that basically writes down each file and folder on a remote share and dumps it to a csv. Everything works wonderfully (there is still a lot of work to be done on the script itself tho) except for the last part. </p>
  
  <pre class="lang-cs prettyprint-override"><code>Import-Csv -Path ($savelocation + '\' + $filename) -Delimiter ',' | ForEach-Object {
      if ($audioarray -contains $_.Extension) {
          $_.MediaType = 'Audio'
          $_
      } elseif ($videoarray -contains $_.Extension) {
          $_.MediaType = 'Video'
          $_
      } elseif ($otherarray -contains $_.Extension) {
          $_.MediaType = 'Other'
          $_
      } else {
          $_
      }
  } | Export-Csv -Path ($savelocation + '\' + $filename) -Force -Delimiter ',' -NoTypeInformation
  </code></pre>
  
  <p>If I change the path to a static location something like <code>\\servername\share\testfolder</code> it works fine. But if I use the above or even if I join the <code>($savelocation + '\' + $filename)</code> into something like <code>$filename</code> it still just writes an empty file.</p>