Only set variables if directories exist