What is the PowerShell command for moving all files from folder A to folder B in an S3 bucket?
You can use the AWS Command-Line Interface (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
.
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 }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.