title: Getting a list of timestamps of all files in a folder and its subfolder in PowerShell in Windows 10
body: <p>I would like to get file tree in text format with all three exact timestamps of each object. I didn't find any utility which offers file tree with <strong>exact</strong> timestamps, so I decided to use PowerShell. Here is a piece of code which I have so far:</p>
  
  <pre><code>        $items = @()
  
      dir -Force | foreach { 
          $Name     = $_.Name            
          $Creation = $_.CreationTimeUtc    
          $Modified = $_.LastWriteTimeUtc   
          $Accessed = $_.LastAccessTimeUtc  
          $Size     = $_.Length
  
          $i = New-Object -TypeName psobject
          $i | Add-Member -MemberType NoteProperty -Name Name               -Value $Name
          $i | Add-Member -MemberType NoteProperty -Name CreatedDateUtc     -Value $Creation
          $i | Add-Member -MemberType NoteProperty -Name CreatedTimeUtc     -Value $Creation.TimeOfDay
          $i | Add-Member -MemberType NoteProperty -Name ModifiedDateUtc    -Value $Modified 
          $i | Add-Member -MemberType NoteProperty -Name ModifiedTimeUtc    -Value $Modified.TimeOfDay
          $i | Add-Member -MemberType NoteProperty -Name AccessedDateUtc    -Value $Accessed 
          $i | Add-Member -MemberType NoteProperty -Name AccessedTimeUtc    -Value $Accessed.TimeOfDay
          $i | Add-Member -MemberType NoteProperty -Name Size               -Value $Size
          $items += $i
          }
  
          $items | Format-Table
  </code></pre>
  
  <p>This code is far from perfect because it doesn't show so many file attributes and because it doesn't show subfolders. I couldn't include more file attributes because width of table is limited in PowerShell.</p>
  
  <p>What I would like is modifying this code so that it includes subdirectories, more file properties and saves result in form of CSV file. Can this be done? And if so, how exactly? Thank you very much.</p>