列出容器中的目录 [英] List directories in a container
问题描述
如何获取容器中的目录列表?
How can I get a list of directories in my container?
我可以使用Get-AzureStorageBlob
获取所有blob并按不同的前缀/name/进行过滤,但是对于数百万个blob来说,速度可能会很慢.
I can use Get-AzureStorageBlob
to get all the blobs and filter by distinct prefix /name/, but it might be slow with millions of blobs.
在PowerShell中是否有实现此目的的正确方法?
Is there a proper way of achieving this in PowerShell?
推荐答案
没有目录的概念,只有容器和Blob. Blob名称可能具有带有外观目录的定界符,并且可能已被过滤.
There's no concept of directories, only containers and blobs. A blob name may have delimiters with look like directories, and may be filtered.
如果您选择将数百万个Blob存储在一个容器中,那么即使使用分隔符过滤(无论是使用PowerShell,SDK还是直接进行REST调用),您都将在数百万个Blob名称中进行搜索.
If you choose to store millions of blobs in a container, then you'll be searching through millions of blob names, even with delimiter filtering, whether using PowerShell, SDK, or direct REST calls.
就正确"方式而言:没有适当的方式:只有您可以决定如何组织容器和blob,以及选择将元数据存储在何处(或 if )以提高效率.搜索(例如数据库).
As far as "proper" way: There is no proper way: Only you can decide how you organize your containers and blobs, and where (or if) you choose to store metadata for more efficient searching (such as a database).
这篇关于列出容器中的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!