最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to get a list of files in an Azure blob storage with "az" command line tool? - Stack Overflow

programmeradmin2浏览0评论

So far I have been using az storage blob directory list -c <ContainerName> -d <DirectoryName> and it has been working. It returns a JSON list of files. Not ideal but it works.

The output contains a warning that the command above is deprecated:

This command is implicitly deprecated because command group 'storage blob directory' is deprecated and will be removed in a future release. Use 'az storage fs directory' instead.

I tried several different ways to use it but it just does not work. az storage fs directory list -f <ContainerName> --path <DirectoryName> --recursive returns an empty list. az storage fs directory exists -f <ContainerName> -n <DirectoryName> returns false. So... I have no idea what to switch to to get a list of my files in Azure.

What is the correct new way to get the list of files in a blob?

So far I have been using az storage blob directory list -c <ContainerName> -d <DirectoryName> and it has been working. It returns a JSON list of files. Not ideal but it works.

The output contains a warning that the command above is deprecated:

This command is implicitly deprecated because command group 'storage blob directory' is deprecated and will be removed in a future release. Use 'az storage fs directory' instead.

I tried several different ways to use it but it just does not work. az storage fs directory list -f <ContainerName> --path <DirectoryName> --recursive returns an empty list. az storage fs directory exists -f <ContainerName> -n <DirectoryName> returns false. So... I have no idea what to switch to to get a list of my files in Azure.

What is the correct new way to get the list of files in a blob?

Share Improve this question edited Mar 18 at 7:33 Venkatesan 10.9k2 gold badges5 silver badges20 bronze badges Recognized by Microsoft Azure Collective asked Mar 18 at 7:27 ApolloApollo 1,8323 gold badges16 silver badges33 bronze badges 8
  • Could you clarify whether the storage account is a general-purpose v2 account or a hierarchical namespace-enabled storage account? – Venkatesan Commented Mar 18 at 7:38
  • Whether you need to list all files in a particular container from storage account? – Venkatesan Commented Mar 18 at 7:39
  • @Venkatesan I am actually not sure. I got the connection data from my colleagues, it is meant for testing purposes. Tools like Cyberduck can access the data with the credentials. How can I check what it is? I just want to check if files I uploaded via an internal program that uses the REST API exists. Sometimes just getting all files in there would be great too. And as written before, az storage blob directory list -c <ContainerName> -d <DirectoryName> just works and does what I want. – Apollo Commented Mar 18 at 7:46
  • 1 Try this learn.microsoft/en-us/cli/azure/storage/… – Venkatesan Commented Mar 18 at 8:04
  • 1 Posting as an answer. – Venkatesan Commented Mar 18 at 8:35
 |  Show 3 more comments

1 Answer 1

Reset to default 1

How to get a list of files in an Azure blob storage with "az" command line tool?

Since the az storage blob directory command group is deprecated, you can use the az storage blob list command instead.

Command:

az storage blob list --container-name <ContainerName> --prefix <DirectoryName>/ --account-name <StorageAccount> 

Output:

The above command will list all blobs that have <DirectoryName>/ as a prefix.

Reference: az storage blob | Microsoft Learn

发布评论

评论列表(0)

  1. 暂无评论