Azure存储容器(门户端)如何上传含子文件夹的完整文件夹?
上传包含子文件夹的完整文件夹到Azure存储容器(免费层)
Azure门户(portal.azure.com)本身没有直接上传整个文件夹的选项,你可以用以下几种方法实现完整文件夹(含子文件夹)的上传,免费层账户完全支持:
方法1:Azure存储资源管理器(推荐)
- 下载安装Azure存储资源管理器,用你的Azure账号登录
- 找到目标存储容器,右键选择上传 > 上传文件夹
- 选中本地要上传的文件夹,确认后即可完整保留文件夹层级结构上传
方法2:Azure CLI命令
- 先在本地终端(Windows命令提示符/PowerShell、macOS/Linux终端)安装Azure CLI,执行
az login登录你的Azure账号 - 运行以下命令替换参数后执行:
az storage blob upload-batch --source "/本地文件夹的绝对路径" --destination "你的容器名称" --account-name "你的存储账户名称"
方法3:PowerShell脚本
- 打开PowerShell,执行
Connect-AzAccount登录Azure账号 - 替换脚本中的参数后运行:
$localFolderPath = "C:\本地文件夹路径" # 替换为你的本地文件夹绝对路径 $targetContainer = "目标容器名称" $storageAccount = "你的存储账户名称" $resourceGroup = "存储账户所属的资源组名称" $storageKey = (Get-AzStorageAccountKey -ResourceGroupName $resourceGroup -AccountName $storageAccount).Value[0] $storageContext = New-AzStorageContext -StorageAccountName $storageAccount -StorageAccountKey $storageKey Get-ChildItem -Path $localFolderPath -Recurse | Set-AzStorageBlobContent -Container $targetContainer -Context $storageContext
内容的提问来源于stack exchange,提问作者Jass Sanghera
相关产品推荐
相关产品推荐

