With zsh:
autoload zmv # best in ~/.zshrc
zmv -n '**/*[[:space:]]' '${f%%[[:space:]]#}'
(remove -n for dry-run when happy)
Would remove trailing whitespace characters from the end of every non hidden file or directory. Add (#q/) to the pattern argument if you want to restrict to directories only. Or (#qD) to also process hidden file.
POSIXly, you can do something approaching with:
LC_ALL=C find . -depth -name '*[[:space:]]' -exec sh -xcx -c '
for f do
: mv -i "$f" "${f%"${f##*[![:space:]]}"}"
done' sh {} +
(remove -x and : when happy).
That one is limited to ASCII whitespace characters.