【发布时间】:2019-04-13 02:16:42
【问题描述】:
我需要从 Azure 存储帐户中的 blob 容器中删除一个文件夹。文件夹结构如下:
container -> failed -> profiles
我连接容器如下:
CloudBlobClient blobClient = StorageAccountManager.getStorageAccount(ConnectionString));
var container = blobClient.GetContainerReference(container_name);
我正在尝试如下引用特定文件夹:
var blob = container.GetBlockBlobReference(failed + "/" + directory);
我也尝试了以下方法:
((CloudBlob)blob).DeleteIfExists();
blob.DeleteIfExists();
blob.DeleteAsync();
但这些都没有删除我的 blob 存储中的文件夹。我错过了什么还是我做错了什么?
【问题讨论】:
-
你需要使用 'GetDirectoryReference("your folder name")' 然后使用 deleteIfExists
-
我应该将 GetDirectoryReference 分配给什么?
-
@Llazar 这个链接有效。是否可以解析所有文件夹以检查该文件夹存在于哪个文件夹中?
-
以编程方式可以遍历文件夹文件,但您需要记住 Azure 存储没有文件夹的含义。
标签: c# asp.net .net azure-storage azure-blob-storage