`file-directory-p` is your friend. Found using `C-u C-h a directory RET` and browsing the result.