/// <summary> /// Copy folder. /// </summary> /// <param name="folder">Source folder.</param> /// <param name="destinationPath">Destination path on the server.</param> /// <returns>True or false operation result.</returns> public async Task <bool> Copy(Folder folder, string destinationPath) { destinationPath = WebDavPath.Clean(destinationPath); // if it linked - just clone var link = await _linkManager.GetItemLink(folder.FullPath, false); if (link != null) { var cloneres = await CloneItem(destinationPath, link.Href); if (cloneres.IsSuccess && WebDavPath.Name(cloneres.Path) != link.Name) { var renRes = await Rename(cloneres.Path, link.Name); return(renRes); } return(cloneres.IsSuccess); } var copyRes = await new CopyRequest(CloudApi, folder.FullPath, destinationPath) .MakeRequestAsync(); if (copyRes.status != 200) { return(false); } //clone all inner links var links = _linkManager.GetChilds(folder.FullPath); foreach (var linka in links) { var linkdest = WebDavPath.ModifyParent(linka.MapPath, WebDavPath.Parent(folder.FullPath), destinationPath); var cloneres = await CloneItem(linkdest, linka.Href); if (cloneres.IsSuccess && WebDavPath.Name(cloneres.Path) != linka.Name) { var renRes = await Rename(cloneres.Path, linka.Name); if (!renRes) { _itemCache.Invalidate(destinationPath); return(false); } } } _itemCache.Invalidate(destinationPath); return(true); }