Skip to content

Instantly share code, notes, and snippets.

@goyalmohit
Created January 26, 2018 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goyalmohit/1ef24ebb389abc0a07c11313abd177c9 to your computer and use it in GitHub Desktop.
Save goyalmohit/1ef24ebb389abc0a07c11313abd177c9 to your computer and use it in GitHub Desktop.
# Uploads file to Azure Container without preserving file hierarchy
$localDir = "C:\Source\ConsoleApp01"
foreach($file in (Get-ChildItem $localDir -File -Recurse)){
Set-AzureStorageBlobContent -Blob $($file.Name) -Container $containerName -File $($file.FullName) -Context $strcontext
}
# Uploads file to Azure Container with preserving file hierarchy
$localDir = "C:\Source\ConsoleApp01"
foreach($file in (Get-ChildItem $localDir -File -Recurse)){
$blobName = $file.FullName.Remove(0,23).Replace("\","/")
Set-AzureStorageBlobContent -Blob $blobName -Container $containerName -File $($file.FullName) -Context $strcontext
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment