title: Powershell Get -ChildItem: filtering csv files and -Recurse not working
body: <p>I created a short powershell script to convert csv files from Unicode to UTF-8 encoding. My script outputs new files with the the original file name preceded by UTF8. I'm running into two issues:</p>
  
  <ol>
  <li><p>I'm trying to only run the powershell script on csv files. Currently the script runs on every file in the directory, including the powershell script (it outputs a new file called UTF8pshell_script if the powershell script was called pshell_script for example). The other methods where I've tried to only run the script on csv files just end up making the script not do anything.</p></li>
  <li><p>I'm trying to run the script on sub-directories. The first issue is that output files created from csv files in subdirectories have no content inside them whatsoever. If the script is ran in the same directory as the csv file this problem does not arise. This is not crucial but I am also uncertain how to get output files created from those in subdirectories to be outputted in the same subdirectories (currently they are outputted in the main directory where the powershell script is).
  as</p></li>
  </ol>
  
  <pre><code>    Get-Content -Encoding Unicode $_ | Out-File -Encoding UTF8
      Get-ChildItem -Recurse | ForEach-Object {Get-Content -Encoding Unicode $_ | Out-File -Encoding UTF8 "UTF8$_"}
  </code></pre>
  
  <p>The desired output is the powershell script running on only csv files, and outputting files to the same subdirectories where the files they were created form are.</p>