microsoft / microsoft/AzureStorageExplorer
Make enabling "Include Directory Stubs" in Settings also add --include-directory-stub flag when uploading for local to blob
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 452
- Forks
- 92
- Avg merge
- 15h 20m
- Merged PRs (30d)
- 3
Description
Problem
I'm uploading a directory tree with empty subfolders in it. Enabling "Include Directory Stubs" in Settings doesn't do anything when uploading for local to blob; under the bonnet AZCopy is not called with --include-directory-stub flag when uploading. I have confirmed this by uploading a folder with Storage Explorer with with empty subfolders and seeing that they have not being uploaded†, and by clicking "Copy AZCopy command to Clipboard" on the upload message in Activities, showing that no --include-directory-stub flag was included.
† Yes I also enabled "Show Stub Blobs for Virtual Directories" in Settings.
When uploading a directory tree with empty subfolders in it using AZCopy directly with the --include-directory-stub flag set, such empty folders are recreated as 0-byte directory stubs with metadata 'hdi_folder=true in the Azure storage location being uploaded to.
Desired Solution
When "Include Directory Stubs" in Settings, pass --include-directory-stub to AzCopy.
Alternatives and Workarounds
Currently the only way to preserve (recreate as stubs) empty subfolders on upload is to use AZCopy directly with a command of the form:
azcopy copy 'D:\path\to\local\az_test_folder' `
'https://my-storage-account.blob.core.windows.net/test-storage-container/' `
--block-blob-tier=Hot `
--from-to=LocalBlob `
--blob-type Detect `
--follow-symlinks `
--check-length=true `
--put-md5 `
--recursive `
--include-directory-stub
Additional Context
I opened this as a feature request instead of a bug as the info text for "Include Directory Stubs" suggests this behaviour is intentional and that directory stubs are only included for service-to-service transfers and not local-to-blob:
Following further context from @craxal , perhaps there could be a separate option checkbox that says something like "Recreate empty folders as stubs for local-to-blob uploads" that toggles on --include-directory-stub to AZCopy for local-to-blob uploads (cf. command in my workaround).
Update 2025-11-06: thanks and apologies to @craxal re: the misleading language when I originally wrote this. I meant to refer to uploading a directory tree with empty subfolders, not uploading a directory tree with stubs.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the “Include Directory Stubs” setting into the local-to-blob upload command generation and compare the generated command with the documented AzCopy example. Done means the intended setting or a separate local-to-blob option causes --include-directory-stub to be passed and empty subfolders are recreated as directory stubs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100