Home > Blockchain >  how to copy data in recursive way?
how to copy data in recursive way?

Time:01-16

I'm trying to copy data from one s3 bucket to another s3 bucket. In source s3 bucket I've data in recursive folders structure.

How can I copy data to destination s3 bucket in same way data is present in source recursive folder structure manner ?

any suggestions ?

CodePudding user response:

Maybe by the s3 way is better.

(1) aws s3 cli - sync

eg: aws s3 sync s3://mybucket-src s3://mybucket-target --exclude *.tmp

(2) Copy an object from one Amazon S3 bucket to another using an AWS SDK

CodePudding user response:

You can use the AWS Command Line Interface (CLI) to copy items from one S3 bucket to another recursively. The command you would use is "aws s3 cp", followed by the source path, the destination path, and the --recursive option.

For example, to copy all items from the "my-bucket" S3 bucket to the "my-destination-bucket" S3 bucket, you would use the following command:

aws s3 cp s3://my-bucket s3://my-destination-bucket --recursive

This command will copy all files and folders in the "my-bucket" bucket to the "my-destination-bucket" bucket, preserving the folder structure.

You can also use the aws s3 sync command to achieve this.

aws s3 sync s3://my-bucket s3://my-destination-bucket

  • Related