title: powershell get-childitem to csv with details
body: <p>I am trying to create a CSV file for a file share that has deep folder structure.</p>
  
  <p>I want the CSV to look like:</p>
  
  <pre><code>filename, filepath, file type, folderStructure
  </code></pre>
  
  <p>So far I have the following:</p>
  
  <pre><code>#Get-ChildItem -Path D:\ -Recurse
  $directory="d:\"
  gci $directory -recurse |
  where {$_.psiscontainer} |
  foreach {
      get-childitem $_.fullname |
      sort creationtime |
      select -expand fullname -last 1
  }
  </code></pre>