Check if directory is valid