It was not specified, but here is a solution without regular expressions if anybody is interested.
We can use
find . -type f to just get files, then utilize
basename to write the conditional. The utilities have the following behavior:
$ find . -type f
basename returns just the filename after the last
$ for file in $(find . -type f); do basename $file; done
dirname gives the entire path up to the final
$ for file in $(find . -type f); do dirname $file; done
basename $(dirname $file) gives the parent directory of the file.
$ for file in $(find . -type f); do basename $(dirname $file) ; done
Combine the above to form the conditional
"$(basename $file)" = "$(basename $(dirname $file))".pdf, then only print each result from
find if that conditional returns true.
$ while read file; do if [ "$(basename "$file")" = "$(basename "$(dirname "$file")")".pdf ]; then echo $file; fi done < <(find . -type f)
./Final Thesis/Final Thesis.pdf
In the above example, we've added a directory/file with spaces in the name to treat that case (thanks to @Kusalananda in the comments)