首页 文章

如何从azure blob容器下载和读取文件

提问于
浏览
1

我有大量的文件从一个前提数据库迁移到azure blob .
我想要的是验证这些文件是否成功迁移 .
因此,我想检查azure blob中的所有文件 .
随着他们的名字,大小,......
如果大小<0或未下载,那么我必须将其报告为已损坏 .

我可以从azure中读取所有文件吗?
我该如何检查它们的大小以及它们是否已下载?

我试过下面的代码:

private const string account = "romantest";
    private const string key = "bwhfbwhfbwhfbwhfbwhfbwhfbwhfbwhfbwhfbwhfbwhfbwhfbwhfbwhf==";
    private const string url = "https://backup.blob.core.windows.net/";
    private const string containerName = "testcontainer";
    private const string blobName = "testblob";

// get storage
        StorageCredentialsAccountAndKey creds = new StorageCredentialsAccountAndKey(account, key);
        CloudBlobClient blobStorage = new CloudBlobClient(url, creds);

        // get blob container
        CloudBlobContainer blobContainer = blobStorage.GetContainerReference(containerName);

        // get blob data
        CloudBlob cloudBlob = blobContainer.GetBlobReference(blobName);
        string text = cloudBlob.DownloadText();

但它没有给出确切的结果 .
请你帮助我好吗?

或者我们可以比较一下:

  • 我们将存储来自Excel或集合中的前提数据库的所有文件 .

  • 逐一阅读

  • 然后我们首先阅读(同时)我们可以检查azure blob容器是否存在相同的文件及其大小 . 下载或不喜欢

请建议我什么 .

1 回答

相关问题