gpt4 book ai didi

powershell - 从 Azure Blob 复制到 AWS S3 存储桶

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

我正在尝试编写一个 PowerShell 脚本,以递归方式从 Azure Blob 复制到 Amazon AWS S3 存储桶,但没有取得太大成功。

有人可以帮我吗?

$container_name = @("<ContainerItemName>")
$connection_string = 'DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>'

$storage_account = New-AzureStorageContext -ConnectionString $connection_string

$S3Bucket = "<BucketName>"

foreach ($container_item in $container_name)
{
$blobs = Get-AzureStorageBlob -Container $container_item -Context $storage_account

foreach ($blob in $blobs)
{
$item = Get-AzureStorageBlobContent -Container $container_item -Blob $blob.Name -Context $storage_account
Write-S3Object -BucketName $S3Bucket -KeyPrefix $container_item\ -Folder $item -Force
}
}

最佳答案

一种选择是使用 Azure 存储数据移动库。您可以在此处下载示例代码:https://github.com/Azure/azure-storage-net-data-movement/tree/master/samples/S3ToAzureSample 。以下文章包含有关数据移动库的更多信息:https://azure.microsoft.com/en-us/blog/introducing-azure-storage-data-movement-library-preview-2/

关于powershell - 从 Azure Blob 复制到 AWS S3 存储桶,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33582304/

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