Create IsDirectory function