如何上传到 Azure blob 并按日期创建子目录

How to upload to Azure blob and create subdirectories by date

我想知道在将文件上传到 Azure blob 容器时是否可以按日期创建子目录。

示例:

Directory 1: 2020
Subdirecotry1: 05
Subdirecotry2: 26

提前致谢!

您可以将容器用作“2020”,其余部分用作 blob 名称的一部分:“05/26/blob.txt”

PS: Azure 存储没有子容器这个概念

成功了!

#FilePath+TimeDate
$year = (Get-Date -Format yyyy)
$month = (Get-Date -Format MM)
$day = (Get-Date -Format dd)


#Upload
Get-ChildItem -File $FilePath1 -Recurse  | Set-AzureStorageBlobContent -Container 
$container -Blob $year/$month/$day/ -Context $StorageContext