Find folders with trailing edges

Hi
Slightly off topic with regards to Seafile.

Many of us might know that Macs can ceate folders with a “space” at the end of the name.

Like here in the folder name of "seafile folder ": //seafilefolder /example.jpg

Windows computer can’t sync these folders. A Windows restriction.

My question is, does anyone know how (in Terminal) on the Mac I could search for all folders that have a trailing space in the name?
Maybe someone already had to look for these folders, same as me now?
I could imagine that it’s handy to have this as info in this forum, also for other users.

Thanks a lot for any help,

Chris

Ok - this was an easy solution:

You find find folders with trailing spaces in MacOS Terminal with this command:

find . -name "* " -type d

But how could the trailing space automatically be deleted? Does someone know this?