windowsListScript function

String windowsListScript(
  1. String path
)

Lists path — dot-entries included, directories suffixed with /, one per line — and prints the listing as base64 of its UTF-8 bytes.

Implementation

String windowsListScript(String path) => _psTry(
  '\$n = @(Get-ChildItem -Force -LiteralPath ${_psq(path)} | '
  "ForEach-Object { if (\$_.PSIsContainer) { \$_.Name + '/' } "
  'else { \$_.Name } }); '
  '[Console]::Out.Write([Convert]::ToBase64String('
  '[Text.Encoding]::UTF8.GetBytes(\$n -join [char]10)))',
);