finding all directories with whitespace at the end of name

Solution 1:

You can try this: find . -d -name "* " -type d -exec bash -c 'TO=$(echo "{}" | sed "s/.$//"); FROM=$(echo "{}"); mv "${FROM}" "${TO}"' \;