Understanding how Azure Blob Storage can be used to simulate directory structures is a little tricky to say the least. I’ve got a long forum thread on the Windows Azure Community site now discussing the details. As always, Steve Marx has been a big help here with a bunch of code. Steve’s got a great blog where he provides lots of examples and insights. Neil Mackenzie has also contributed here to getting to the answer.
Just so we now have an example, I’ve put together a simple windows form app that let’s you set a few variables in your app.config to point at your azure storage and container, let you view your app as a tree as well as see the code how it can be done. I have not commented the code much, just thought it would be good to get it out there. The running application shows you the data as follows.
So, for the details, I’m pasting below the meet of the code. Basically, it does what you would expect in terms of iterating through the directories recursively to build the list. Again, just set your parameters in your app.config as follows:
and you can run it for yourself and see how it goes.
I’m pasting some code below, as well as including the project source code. The main reason I’m pasting the code is so that the search engines can find it better. It’s really just easier to download the project and load it into Visual Studio 2010 and run it yourself.
Good Luck, and hope this helps!