for f in $(find dir1/ -type f | awk -F/ '{print $NF}') ; do find dir2/ -type f -name "$f" -exec echo {} is in both \; done