How to remove space character (whitespace) from end of filenames and foldernames?
Here's the script to find and remove trailing space from files and dirs:

#!/bin/bash                                                                                                                                                                                                        

IFS=$'\n'
for file in $(find -d . -name "* ")
do
  target_name=$(echo "$file" | sed 's/[ \t]*$//')
  if [ "$file" != "$target_name" ]; then
      if [ -e "$target_name" ]; then
          echo "WARNING: $target_name already exists, file not renamed"
      else
          echo "Move $file to $target_name"
          mv "$file" "$target_name"
      fi
  fi
done