如何检查azure容器中是否存在多个文件

问题描述 投票:0回答:1

要检查天蓝色容器中是否存在单个blob,我们有以下解决方案,

public bool DoesFileExistsInContainer(string fileName, string containerName)
    {
        try
        {
            if (fileName == null)
            {
                throw new ArgumentException("File name to be moved is empty");
            }
            CloudBlobContainer containerReference = blobClient.GetContainerReference(containerName);
            CloudBlockBlob blob = containerReference.GetBlockBlobReference(fileName);

            bool isFileExist = blob.Exists();                
            return isFileExist;
        }
        catch (StorageException ex)
        {
            Logger.LogError("error while checking if blob exists : {0}" + ex);
            throw;
        }
    }

但我想检查天蓝色容器中是否存在多个文件?

stringstyle filestosearchinblob = {“fille1.hml”,“fille2.hml”,“filiz.hml”};

有没有一种有效的方法来检查除了foreach循环..?使用LINQ?我们能以更好的方式做到吗?

提前致谢

他们的

azure-storage exists multiple-files not-exists
1个回答
0
投票

我认为没有比foreach循环更有效的方法。如果您认为性能是一个问题,您可以考虑同时调用Exists方法。

© www.soinside.com 2019 - 2024. All rights reserved.