[英]Is there a PowerShell command that can move files between two folders in an S3 bucket?
What is the PowerShell command for moving all files from folder A to folder B in an S3 bucket?在 S3 存储桶中将所有文件从文件夹 A 移动到文件夹 B 的 PowerShell 命令是什么?
You can use the AWS Command-Line Interface (CLI) :您可以使用AWS 命令行界面 (CLI) :
aws s3 mv --recursive s3://my-bucket/folderA/ s3://my-bucket/folderB/
It will perform a CopyObject
and a DeleteObject
object for each object in folderA
.它将为
folderA
中的每个 object 执行CopyObject
和DeleteObject
object 。
This worked fo me这对我有用
Get-S3Object -BucketName "mybucket" -Prefix "folderA/" | % { Copy-S3Object -BucketName "mybucket" -Key $_.Key -DestinationKey $($_.Key).Replace('folderA','folderB'); Remove-S3Object -BucketName "mybucket" -Key $_.Key -Force }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.