【发布时间】:2020-11-03 08:33:42
【问题描述】:
我正在尝试从现有的 Azure blob 复制到具有相同文件名的新位置。这两个文件夹在同一个容器中。有什么想法吗?
// details of where we want to copy from
var sourceContainerName = blobContainer.ToString();
string fileName = Path.GetFileName(@dirItem.Uri.ToString());
var sourceFilePath = "192-168-2-44/img/" + fileName;
// details of where we want to copy to
var destContainerName = blobContainer.ToString();
var destFilePath = "192-168-2-44/archive/" + fileName;
var sourceContainer = blobClient.GetContainerReference(sourceContainerName);
var destContainer = blobClient.GetContainerReference(destContainerName);
Console.WriteLine(sourceContainer);
Console.WriteLine(destContainer);
CloudBlockBlob sourceBlob = sourceContainer.GetBlockBlobReference(sourceFilePath);
CloudBlockBlob destBlob = destContainer.GetBlockBlobReference(destFilePath);
await destBlob.StartCopyAsync(sourceBlob);
【问题讨论】:
-
有错误吗?你在看什么?
-
我在 VS 或浏览器中没有看到任何错误,并且文件没有被传输。
-
你见过这个吗? microsoft.github.io/AzureTipsAndTricks/blog/tip78.html 只是我看到的东西。