简体   繁体   English

是否有可以在 S3 存储桶中的两个文件夹之间移动文件的 PowerShell 命令?

[英]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 执行CopyObjectDeleteObject 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.

相关问题 用于在 Amazon S3 中移动/修改文件/文件夹的命令行工具 - Command line tool to move/modify files/folders in Amazon S3 有没有办法列出两个日期之间的S3存储桶中的所有文件? - Is there a way to list all files in a S3 bucket between two dates? 使用 PowerShell 递归删除 S3 存储桶下超过 30 天的文件而不删除文件夹 - Delete files older than 30 days under S3 bucket recursively without deleting folders using PowerShell 使用PowerShell将新文件从S3存储桶中新创建的文件夹复制到本地计算机 - Copying new files from newly created folders in my S3 bucket to my local machine using PowerShell AWS S3 在两个存储桶之间复制文件和文件夹 - AWS S3 copy files and folders between two buckets 如何从 S3 解压缩 ZIP 文件,重新压缩它们,然后将它们移动到 S3 存储桶? - How can I decompress ZIP files from S3, recompress them & then move them to an S3 bucket? 适用于 AWS 的 PowerShell:仅列出 S3 存储桶中的“文件夹”? - PowerShell for AWS: List only "folders" from S3 bucket? 两个存储桶之间的S3移动模式无法捕获文件 - S3 move pattern between two buckets fails to capture files 如何使用命令行将文件从亚马逊 ec2 移动到 s3 存储桶 - How to move files from amazon ec2 to s3 bucket using command line 使用 boto3 在 Amazon S3 上的文件夹之间移动文件(指定的存储桶不存在错误) - Move files between folder on Amazon S3 using boto3 ( The specified bucket does not exist error)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM