Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to clone a directory in an S3 bucket to another path within the same bucket?

I've searched and read quite a bit but can't find an answer to this question so I assume it's not possible.

Can I clone (or copy) a path within an S3 bucket to another path and have it copy all sub-paths and files recursively?

I've seen similar things done with S3FS but I would rather not have to make that step.

I've tried from the shell and it creates the destination directory but nothing inside:

aws s3api copy-object --copy-source my-bucket/source/ --key dest/ --bucket my-bucket

like image 275
Dubby Avatar asked Dec 12 '25 05:12

Dubby


1 Answers

Rather than using the copy-object API call, use the nicer aws s3 cp command provided by the AWS Command-Line Interface (CLI):

aws s3 cp s3://my-bucket/source s3://mybucket/dest --recursive
like image 170
John Rotenstein Avatar answered Dec 14 '25 23:12

John Rotenstein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!