This is the easiest way I’ve found to replace spaces in file names with another character for example underscore.
At a bash prompt, use rename:
find -name "* *" -type d | rename 's/ /_/g' # do the directories first find -name "* *" -type f | rename 's/ /_/g'
This does the trick nicely.
Bulk Replace Spaces in File Names