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 | Show 3 more comments1 Answer
Reset to default 1How 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
az storage blob directory list -c <ContainerName> -d <DirectoryName>
just works and does what I want. – Apollo Commented Mar 18 at 7:46