Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Last active Oct 29, 2021
Embed
What would you like to do?
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