Skip to content

Instantly share code, notes, and snippets.

@Swiss-Mac-User
Created June 22, 2023 21:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Swiss-Mac-User/92a5f1812c09d5b9c5d32395edb6ea16 to your computer and use it in GitHub Desktop.
Save Swiss-Mac-User/92a5f1812c09d5b9c5d32395edb6ea16 to your computer and use it in GitHub Desktop.
Find non UTF-8 encoded files on macOS: a shell command to recursively list all non UTF-8 encoded files within a directory (and its subdirectories)
find /path/to/dir -maxdepth 2 -type f -exec sh -c 'iconv -f utf-8 -t utf-8 "{}" >/dev/null 2>&1 || echo "{}: Not UTF-8"' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment