![](/img/trans.png)
[英]azure storage / c#: Download all files from a directory in a container
[英]How to download all files from Azure Storage using C#?
我是Azure Storage的新手 。 因此,請考慮我在帖子中的內容。 我有一個Azure Storag
帳戶,上面all files stored
。 現在,我想folder by looping through each directory and sub directory of the Azure Storage
download
所有這些files
download
到一個folder by looping through each directory and sub directory of the Azure Storage
。
樣例代碼:
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
// Retrieve reference to a blob named "photo1.jpg".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("photo1.jpg");
// Save blob contents to a file.
using (var fileStream = System.IO.File.OpenWrite(@"path\myfile"))
{
blockBlob.DownloadToStream(fileStream);
}
但是我無法獲得所有“容器”及其包含子內容的內容。
幫助贊賞!
使用blobClient。 ListContainers ()獲取所有容器,並使用容器。 ListBlobs ()獲取容器中的所有blob。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.