问题描述
我正在使用azure blob存储来存储我的项目文件。
我有一个Azure Blob存储服务帐户(client_id和client_secret)。我已经使用CloudBlobClient
创建了StorageCredentialsToken
,如下所示:
StorageCredentialsToken credentialsToken = new StorageCredentialsToken("account name","access token generated uing client_id and client_secret");
CloudBlobClient blobClient = new CloudBlobClient(new URI("https://accountname.blob.core.windows.net/"),credentialsToken);
CloudBlobContainer cloudBlobContainer = blobClient.getContainerReference("conteiner name");
现在使用CloudBlobContainer
一次可以删除一个文件:
CloudBlockBlob blockBlobReference = cloudBlobContainer.getBlockBlobReference(key);
if (blockBlobReference.exists()) {
blockBlobReference.delete();
}
如何通过一个电话删除多个文件?
我找到this文档,该文档表示我们可以使用BlobBatchClient
删除多个文件。在文档中,我找不到使用服务帐户(使用由client_id和client_secret获得的访问令牌)创建BlobBatchClient
的任何方法。
是否可以删除异步调用中的文件,因为我需要删除100多个文件? 还有其他批量删除文件的解决方案吗?
SDK版本compile group: 'com.microsoft.azure',name: 'azure-storage',version: '8.6.5'
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)