detox does directories at least one level deep.
$ detox --dry-run B*
Bad Name@spaces -> Bad_Name_spaces
Bad Name@spaces/What*kind!of stupid@name-is-this -> Bad Name@spaces/What_kind_of_stupid_name-is-this
I hadn't heard of detox before seeing this posting, but I tried it on cygwin and linux.
A little annoying to have to load lex and yacc, two of my least favorite topics, and the lowest grade I received in college ;-(
but it handles a directory at the top level with a bad name.
$ your_script 'Bad Name@spaces'
line 7: cd: Bad: No such file or directory
I had to back up to a good directory for this script to rename the "Bad" directory, as well as the underlying file that detox cleaned.

































