Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Last active October 29, 2021 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziadoz/c226ce587bc11f60c16cd623afe50d7a to your computer and use it in GitHub Desktop.
Save ziadoz/c226ce587bc11f60c16cd623afe50d7a to your computer and use it in GitHub Desktop.
Remove Special Characters From macOS Filenames
#!/usr/bin/env bash
# @see: https://superuser.com/questions/617517/remove-all-illegal-characters-from-all-filenames-in-a-given-folder
# The 's/[\:?\\]//g' regular expression removes ?, : and \ characters.
# Dry Run:
find "/path/to/files" -type f -exec rename -n 's/[\:?\\]//g' {} \;
# Execute:
find "/path/to/files" -type f -exec rename 's/[\:?\\]//g' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment