![](/img/trans.png)
[英]List all file share from storage account using azure .net SDK or Fluent API?
[英]How to list all the Directories or Files, from a root Directory, in Azure File Storage -and- using the .NET Storage SDK?
我想弄清楚如何
-或者-
MS 文檔確實為我們提供了一個 API 端點以供使用……但我希望使用 .NET Storage SDK 來為我處理許多低級通信(身份驗證等)。
任何人都可以告訴我這樣做需要什么嗎?
請查看我們的文件存儲示例以獲取一些顯示如何執行此操作的代碼。
片段:
//***** Get list of all files/directories on the file share*****//
// List all files/directories under the root directory.
Console.WriteLine("Getting list of all files/directories under the root directory of the share.");
IEnumerable<IListFileItem> fileList = cloudFileShare.GetRootDirectoryReference().ListFilesAndDirectories();
// Print all files/directories listed above.
foreach (IListFileItem listItem in fileList)
{
// listItem type will be CloudFile or CloudFileDirectory.
Console.WriteLine(" - {0} (type: {1})", listItem.Uri, listItem.GetType());
}
Console.WriteLine("Getting list of all files/directories in the file directory on the share.");
var directories = fileDirectory.ListFilesAndDirectories().Where(x => x.GetType() ==
typeof(CloudFileDirectory)).Cast<CloudFileDirectory>();
var files = fileDirectory.ListFilesAndDirectories().Where(x => x.GetType() ==
typeof(CloudFile)).Cast<CloudFile>().ToList();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.