Check if directory exists instead of checking if file exists.