You can just do something like this
find -name '*\?*' -exec bash -c 'echo mv -iv "$0" "${0//\?/}"' {} \;
Note the echo before the mv so you can see what it does before actually changing anything. Otherwise above:
- searches for
?
in the name (?
is equivalent to a single char version of*
so needs to be escaped) - executes a bash command passing the
{}
as the first argument (since there is no script name it's$0
instead of$1
) ${0//\?/}
performs parameter expansion in bash replacing all occurrences of?
with nothing.
Note also that file types do not depend on the name in linux, but this should not change any file extension unless they contain ?
.
Also this will rename symlinks as well if they contain ?
(not clear whether or not that was expected from question).