gpt4 book ai didi

azure - 将文件保存到子目录中的 Azure fileshare

转载 作者:行者123 更新时间:2023-12-03 03:56:12 26 4
gpt4 key购买 nike

下面是我用来将文件保存到 azure fileshare 的 Runbook 代码。但无法保存在子目录中。

#Set the context using the storage account name and key
$context = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey


$s = Get-AzureStorageShare "X1" –Context $context


$ErrorLogFileName = "Test.csv"
$LogItem = New-Item -ItemType File -Name $ErrorLogFileName
$_ | Out-File -FilePath $ErrorLogFileName -Append


Set-AzureStorageFileContent –Share $s –Source $ErrorLogFileName

这里我有一个类似X1/X2的文件夹结构。但无法到达那里并保存 Test.csv。事实上能够将其保存在 Azure 文件共享上的 X1 文件夹中。有什么想法吗?

提前致谢

最佳答案

您可以为 Set-AzureStorageFileContent 指定 -Path 参数.

例如,文件共享为X1,X1内有一个文件夹X2。然后您可以使用以下命令:

Set-AzureStorageFileContent –Share "X1" –Source $ErrorLogFileName -Path "X2" -Context $context

顺便说一下,您使用的命令是旧的,请尝试考虑使用最新的az powershell命令。例如,您可以使用 Set-AzStorageFileContent 代替 Set-AzureStorageFileContent(如果您尝试使用 az 模块,请用新命令替换所有旧命令) .

关于azure - 将文件保存到子目录中的 Azure fileshare,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64499082/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com