Remove question mark "?" from file names OSX

Solution 1:

Open Terminal and change to your directory, then use the command listed to remove all occurrences of ? within your filenames in that directory:

cd ~/music/artist/album/

for f in *; do mv -- "$f" "${f//\?/}"; done

Before you commit to runing the command you can test it, which will show you the original filename followed by new one:

for f in *; do echo -- "$f" "${f//\?/}"; done

-- 01 title with?.flac 01 title with.flac

To do this recursively you'll need to use the find command, and definitely try it in a test directory first. Messing up on the replacement strings of all your filenames could make things far worse than better. For recursive operations such as this I always recommend backing up your data beforehand.

The first command is the dry run, meaning nothing is actually changed. The second command is the real thing, which recursively renames all filenames (eliminating question marks) in the current directory and all sub-directories:

find . -type f -name '*\?*' | while read f; do echo mv "$f" "${f//\?/}"; done

find . -type f -name '*\?*' | while read f; do mv "$f" "${f//\?/}"; done