So for each subdirectory, if the subdirectory contains a PDF file, do X, else do Y. What if there are multiple PDF files in a directory? The following will loop over them.
Code:
set -o nullglob
for f in /myserver/myfolder/*/; do
pdf=false
for p in "$f"/*.pdf; do
X
pdf=true
done
if ! $pdf; then
Z
fi
done