How to create a sub directory in a blob container

0 votes
Mar 26, 2019 in Azure by sabby
• 4,380 points
10,064 views

1 answer to this question.

0 votes

There are two ways: 

  • using the GetDirectoryReference
  • looping through a containers blobs and checking the type

The code below is in C#

CloudBlobContainer container = blobClient.GetContainerReference("photos");

//Method 1. grab a folder reference directly from the container
CloudBlobDirectory folder = container.GetDirectoryReference("directoryName");

//Method 2. Loop over container and grab folders.
foreach (IListBlobItem item in container.ListBlobs(null, false))
{
    if (item.GetType() == typeof(CloudBlobDirectory))
    {
        // we know this is a sub directory now
        CloudBlobDirectory subFolder = (CloudBlobDirectory)item;

        Console.WriteLine("Directory: {0}", subFolder.Uri);
    }
}

answered Mar 26, 2019 by prerna
• 1,960 points

Related Questions In Azure

0 votes
0 answers

How to create a sub-container in Azure?

How to create a sub-container in Azure ...READ MORE

Jun 28, 2019 in Azure by sabby
• 4,380 points
631 views
0 votes
1 answer

How to create a sub-container in Azure?

You can create a container named "content" and ...READ MORE

answered Jun 28, 2019 in Azure by Perry
• 17,100 points

edited Oct 7, 2021 by Sarfaraz 1,151 views
0 votes
1 answer

How to get the list of names of Azure blob files in a container?

We can get some additional info like Size, ...READ MORE

answered Jun 27, 2018 in Azure by club_seesharp
• 3,450 points
15,056 views
0 votes
1 answer

How to create a container in Azure Cloud?

Hi@akhtar, You can launch a container on any ...READ MORE

answered Nov 13, 2020 in Azure by MD
• 95,360 points
145 views
0 votes
1 answer

How to install Windows Azure Storage Emulator?

There may be an issue with the ...READ MORE

answered Mar 7, 2019 in Azure by prerna
• 1,960 points
1,803 views
0 votes
1 answer

Azure Storage Emulator shows error.

This blog might help with your query: http://blog.smarx.com/posts/windows-azure-storage-emulator-the-process-cannot-access-the-file-because-it-is-being-used-by-another-process Also, ...READ MORE

answered Mar 16, 2019 in Azure by prerna
• 1,960 points
924 views
0 votes
1 answer

Friendly filename when downloading Azure blob.

Azure blobs can be downloaded in four ...READ MORE

answered Mar 16, 2019 in Azure by prerna
• 1,960 points
1,910 views
0 votes
1 answer

How to debug Azure 500 internal server error?

You can simply turn off custom error in ...READ MORE

answered Mar 29, 2019 in Azure by prerna
• 1,960 points
3,748 views
0 votes
1 answer

How to check if multiple files exist in Azure container?

foreach loop is the most efficient way though. ...READ MORE

answered Mar 4, 2019 in Azure by prerna
• 1,960 points
2,320 views
0 votes
1 answer

How to download a file from Blob Storage to the browser?

If you use ASP.NET (core), you can ...READ MORE

answered Mar 26, 2019 in Azure by prerna
• 1,960 points
5,438 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP