-
Notifications
You must be signed in to change notification settings - Fork 3.4k
storage blob download-batch fails with "[Errno 20] Not a directory" #32427
Copy link
Copy link
Open
Labels
Auto-AssignAuto assign by botAuto assign by botAuto-ResolveAuto resolve by botAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamSimilar-IssueStorageaz storageaz storageact-codegen-extensibility-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Metadata
Metadata
Labels
Auto-AssignAuto assign by botAuto assign by botAuto-ResolveAuto resolve by botAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamSimilar-IssueStorageaz storageaz storageact-codegen-extensibility-squadcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Type
Fields
Give feedbackNo fields configured for issues without a type.
Describe the bug
The
download-batchcommand fails when downloaded nested subfolders from Data Lake Storage. Folders, in this case, are represented as zero-byte blobs. For example,az storage blob download-batch -s https://sciencelibrarieswestus2.blob.core.windows.net/external-data-share -d stanford --pattern stanford/*When you download nested subfolders, a zero byte file gets written to the destination on local disk, called
dataset_ain my case. Since that's not a directory, you get the following error when you try to write the files inside thatdataset_asubfolder.[Errno 20] Not a directory: 'stanford/stanford/dataset_a/dataset_a_Summary.csv'
You can work around by creating the local directory structure manually and downloading the leave files only, but that's quite tedious.
Related command
az storage blob download-batch
Errors
[Errno 20] Not a directory
Issue script & Debug output
Didn't get a chance to do this.
Expected behavior
make directories instead of zero-byte files.
Environment Summary
az --version
azure-cli 2.75.0
core 2.75.0
telemetry 1.1.0
Dependencies:
msal 1.33.0b1
azure-mgmt-resource 23.3.0
Python location '/opt/az/bin/python3'
Config directory '/home/christopherbare/.azure'
Extensions directory '/home/christopherbare/.azure/cliextensions'
Python (Linux) 3.12.10 (main, Jun 24 2025, 10:15:18) [GCC 13.3.0]
Additional context
No response