try {
ApiClient api = ApiClientFactory.create(u);
boolean createdFolder = false;
if (! api.exists(folder)) {
Logger.info("Folder does not exist attempting to create %s", folder);
if (api.mkdir(folder)) {
Logger.info("Successfully created folder %s", folder);
createdFolder = true;
} else {
Logger.error("Failed to create folder '%s'", folder);
flash.error("Error: folder %s is missing and we couldn't create it.", folder);