【发布时间】:2020-12-01 18:00:30
【问题描述】:
我有一个包含许多容器的 Azure Blob。每个容器都有多个文件夹 - 每个文件夹中都有一堆文件。我希望能够抓取所有文件并将它们压缩后返回。我目前一次只能获取一个文件...
public void downloadAllFromBlob(String containerName){
CloudBlobClient blobClient = this.storageAccount.createCloudBlobClient();
try{
CloudBlobContainer container = blobClient.getContainerReference(containerName);
if(container.exists()){
// I want to grab all the files in the container and zip them
for(ListBlobItem blobItem: container.listBlobs()){
// i'm only able to list/VIEW the blobs, and not go into one and get all the contents
}
}
}catch(){
}
}
【问题讨论】:
-
没有任何可用的 API,但您可以使用 az 命令行工具。 docs.microsoft.com/en-us/cli/azure/storage/…
-
@Manish 我能够做到这一点 - 为什么 CLI 工具没有可用的 API?
-
测试版中有一个 API 可用,称为批处理,但我没有检查它的作用。但您可以使用 CLI 工具创建后台服务。
标签: java azure spring-boot azure-blob-storage