find /directory | awk '{names[gensub(".*/","","g")]++} END { for (name in names) { if (names[name] > 1) { print name } } }'
Might give you a list of duplicate names (files and folders). That gives you a starting point.
The above assumes gawk
, so here is a more general solution which even supports mixed-case filenames, kudos to mklement0 for the idea:
find /directory | awk -F '/' '{names[tolower($NF)]++} END { for (name in names) { if (names[name]>1) { print name }}}'