$ErrorActionPreference = 'Continue'
$root = 'D:\xcode\xdemo\realtime-screen-ocr-rust\pptx-rs\src'
Get-ChildItem -Path $root -Recurse -Filter '*.rs' |
  Where-Object { $_.FullName -notmatch '\\pyscripts\\' } |
  ForEach-Object {
    $lines = (Get-Content $_.FullName -Encoding UTF8 | Measure-Object -Line).Lines
    [PSCustomObject]@{
      File = $_.FullName.Substring($root.Length + 1)
      Bytes = $_.Length
      Lines = $lines
      LastWrite = $_.LastWriteTime.ToString('yyyy-MM-dd HH:mm')
    }
  } |
  Sort-Object File |
  Format-Table -AutoSize | Out-File -FilePath 'D:\xcode\xdemo\realtime-screen-ocr-rust\pptx-rs\v6-linecount.txt' -Encoding UTF8
Write-Output 'DONE'
