【问题标题】:Using a delimiter with azure storage blob list使用带有 azure 存储 blob 列表的分隔符
【发布时间】:2016-09-13 22:44:12
【问题描述】:

适用于 Azure 的 Python SDK 提供 list_blobs 方法,用于使用容器名称、前缀和分隔符列出容器中存在的 blob。

基于 Node.js 的 azure-cli 还提供了列出 blob 的选项

azure 存储 blob 列表 [选项] [容器] [前缀]

我查看了上述命令的帮助,但找不到使用分隔符的选项。

有没有办法在上述命令中使用分隔符?

【问题讨论】:

  • 您能解释一下您要做什么吗?不太清楚你想如何使用“分隔符”。
  • 我正在尝试列出容器的内容,以便输出看起来像目录列表。使用 Python SDK 中的 list_blobs,这是以下几行的内容: list_blobs(container, delimiter="/", prefix="some_prefix/") 给出输出: some_prefix// (如果 blob 是目录)

标签: azure azure-blob-storage azure-cli azure-sdk-python


【解决方案1】:

有没有办法在上述命令中使用分隔符 ?

截至今天,没有。在 Blob 容器中列出 Blob 时,无法指定分隔符。

CLI 工具源代码可在 Github 上获得:https://github.com/Azure/azure-xplat-cli。您可以做的是在那里提出问题并要求此功能或尝试自己实现此功能。您要进行更改的文件是:https://github.com/Azure/azure-xplat-cli/blob/dev/lib/commands/storage/storage.blob._js

【讨论】:

  • 感谢您的回答。我在 Github 上提出了一个问题,要求提供此功能。
【解决方案2】:

截至目前,有:

$ az storage blob list -h
...
    --delimiter                    : When the request includes this parameter, the operation returns
                                     a :class:`~azure.storage.blob.models.BlobPrefix` element in the
                                     result list that acts as a placeholder for all blobs whose
                                     names begin with the same substring up to the appearance of the
                                     delimiter character. The delimiter may be a single character or
                                     a string.
...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-19
    • 2012-03-02
    • 2019-09-26
    • 2020-05-30
    • 2017-10-14
    • 1970-01-01
    相关资源
    最近更新 更多