checked if the specified directory exists.