Upload files and folder into Azure Blob Storage
<p>I have created a storage account in Azure and created a container. I am trying to upload files stored in my Server the files are stored within 800 folders. 
I have tried doing this with this Powershell script however it does not work with the subfolders. </p>

<pre><code>$LocalFolder = "\\Server\Data" 

Add-AzureAccount 


# Set a default Azure subscription.
Select-AzureSubscription -SubscriptionName 'nameofsubscription' –Default


$Key = Get-AzureStorageKey -StorageAccountName  mydatastorename

$Context = New-AzureStorageContext -StorageAccountKey $Key.Primary -StorageAccountName mydatastorename

foreach ($folder in Get-ChildItem $LocalFolder)
    {

            ls –Recurse –Path $LocalFolder |Set-AzureStorageBlobContent  -Container nameofcontainer -Context $Context -BlobType Block
    }
</code></pre>

<p>If set the $LocalFolder as "\Server\Data\subfolders001" the files in subfolder001 get uploaded to the container. But when I keep it as "\Server\Data" then it does not work. </p>

<p>I want the script to upload all the sub folders and files within into the storage container. </p>

<p>I have added the output I get when I run it </p>

<p>I don't get any error message, but one warning message each subfolder</p>

<pre><code> WARNING: Can not upload the directory '\\Server\Data\subfolders001' to azure. If you want to upload directory, please use "ls -File -Recurse | Set-AzureStorageBlobContent -Container containerName".
</code></pre>

<p>Then noting happens after waiting for a while I have to stop the powershell script.</p>