简体   繁体   English

获取 Azure 数据湖中使用了多少磁盘

[英]Get how much disk is being used in Azure Data Lake

I'm using Azure.Storage.Files.DataLake to programmatically interact with Azure.我正在使用Azure.Storage.Files.DataLake以编程方式与 Azure 交互。

It looks like I can get the size of a given file with看起来我可以得到给定文件的大小

var props = await fileClient.GetPropertiesAsync();
var fileSizeInBytes = propriedades.Value.ContentLength;

(where fileClient is an instace of DataLakeFileClient ) (其中fileClientDataLakeFileClient的一个实例)

DataLakeDirectoryClient class offers a similar API, but ContentLength is always zero. DataLakeDirectoryClient class 提供了类似的 API,但ContentLength始终为零。

I would like to know how to get the size of:我想知道如何获得大小:

  1. a directory (with DataLakeDirectoryClient )一个目录(带有DataLakeDirectoryClient
  2. a file system (with DataLakeFileSystemClient )文件系统(使用DataLakeFileSystemClient

You can use, DataLakeStoreFileSystemManagementClient.FileSystem.GetContentSummary:您可以使用 DataLakeStoreFileSystemManagementClient.FileSystem.GetContentSummary:

var client = new DataLakeStoreFileSystemManagementClient(credentials);
ContentSummaryResult result = client.FileSystem.GetContentSummary(dataLakeAccount, path);
var dirSize = result.ContentSummary.Length;

For further details you can refer Documentation .有关更多详细信息,您可以参考文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM