in reply to -d fails outside the current working directory
Have a look at Problems with -filetest on readdir results for a few more ways to fix it.