

find . -type d -iname '* *' -exec sh -c 'mv "$1" "${1// /_}"' -- {} \;







