title: Powershell: File properties - Bytes to Mb
body: <p>Currently have the following script that outputs some file data to a report.  The file length is in bytes though and wondering how I can convert that to MB before outputting to the array. </p>
  
  <pre><code>$arr = @()
  gci C:\stuff -recurse | ? {$_.PSIsContainer -eq $False} | % {
     $obj = New-Object PSObject
     $obj | Add-Member NoteProperty Directory $_.DirectoryName
     $obj | Add-Member NoteProperty Name $_.Name
     $obj | Add-Member NoteProperty Length $_.Length
     $obj | Add-Member NoteProperty created $_.creationtime
     $obj | Add-Member NoteProperty Access $_.LastAccessTime
     $obj | Add-Member NoteProperty LastWritten $_.LastWriteTime
     $obj | Add-Member NoteProperty Extension $_.Extension
     $obj | Add-Member NoteProperty Owner ((Get-ACL $_.FullName).Owner)
     $arr += $obj
  }
  $arr | Export-CSV -notypeinformation "c:\files.csv"
  </code></pre>