Skip to content

Instantly share code, notes, and snippets.

@lansalot
Created October 1, 2020 14:51
Show Gist options
  • Save lansalot/19c899b770c312262a81c15c9fa118af to your computer and use it in GitHub Desktop.
Save lansalot/19c899b770c312262a81c15c9fa118af to your computer and use it in GitHub Desktop.
Find a filename with a bad character in it
[System.Text.Encoding]::UTF8.GetBytes( ((dir badfilename.txt).Name))
That showed me the bad filenames had char(127) in them
So dir c:\pathwithbadfiles -recurse -ea silentlycontinue | Where-Object { $_.Name.ToCharArray() -eq 127}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment