Check if a directory exists