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

问题描述 投票:0回答:1

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

例子:目录1:2020Subdirecotry1:05Subdirecotry2:26

目录1: 2020Subdirecotry1: 05Subdirecotry2: 26

先谢谢你

azure powershell azure-devops azure-functions azure-powershell
1个回答
1
投票

这做到了!你可以使用容器为 "2020"。

#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

0
投票

您可以使用容器作为 "2020",其余部分作为您的blob名称的一部分:"0526blob.txt"

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

© www.soinside.com 2019 - 2024. All rights reserved.