if ($operation -eq 'ls') {
  $all = $false; $limit = 200; $path = '.'
  for ($i = 0; $i -lt $toolArgs.Count; $i++) {
    $arg = $toolArgs[$i]
    if ($arg -in @('-a', '--all')) { $all = $true; continue }
    if ($arg -in @('-l', '-la', '-al')) { if ($arg.Contains('a')) { $all = $true }; continue }
    if ($arg -eq '--limit') { $i += 1; if ($i -ge $toolArgs.Count) { Fail '--limit requires a value' 2 }; $limit = Parse-NonNegativeInt '--limit' $toolArgs[$i] 5000; continue }
    if ($arg.StartsWith('--limit=')) { $limit = Parse-NonNegativeInt '--limit' $arg.Substring(8) 5000; continue }
    if ($arg.StartsWith('-') -and $arg -ne '-') { Fail ('unsupported ls option on Windows route: ' + $arg) 2 }
    $path = $arg
  }
  $target = Resolve-UnideskPath $path
  if (-not (Test-Path -LiteralPath $target)) { Fail ('path not found: ' + $target) 1 }
  $items = if (Test-Path -LiteralPath $target -PathType Container) { @(Get-ChildItem -LiteralPath $target -Force:$all | Sort-Object Name) } else { @(Get-Item -LiteralPath $target) }
  [Console]::Out.WriteLine('TYPE BYTES UPDATED NAME')
  $count = 0
  foreach ($item in $items) {
    if ($count -ge $limit) { [Console]::Error.WriteLine('UNIDESK_WINDOWS_FS_TRUNCATED ls limit=' + $limit); break }
    $type = if ($item.PSIsContainer) { 'dir' } else { 'file' }
    $bytes = if ($item.PSIsContainer) { '-' } else { [string]$item.Length }
    [Console]::Out.WriteLine($type + ' ' + $bytes + ' ' + $item.LastWriteTimeUtc.ToString('o') + ' ' + $item.Name)
    $count += 1
  }
  exit 0
}
