Home > OS >  Copy objects with different prefixes from AWS S3 bucket to local host will create folders locally?
Copy objects with different prefixes from AWS S3 bucket to local host will create folders locally?

Time:11-25

Will aws s3 sync s3://myBucket/this_folder/object_file C:\\Users\Desktop create also the "this_folder" in C:\Users\Desktop? If not, what would be the solution to copy/sync including the folder structure of S3? I mean I have many files in different S3 bucket folders sorted by year, month, day. I would like to copy them locally with the folder structure/tree to be created locally as it is in the S3 bucket. Thank you.

CodePudding user response:

Will aws s3 sync s3://myBucket/this_folder/object_file C:\Users\Desktop create also the "this_folder" in C:\Users\Desktop?

Yes, it will. aws s3 sync is recursive by default.

You may want to consider adding the --delete option to make sure that the local directory C:\Users\Desktop does not have deprecated files that are no longer in the bucket.

CodePudding user response:

Use the aws cli with the --recursive argument.

For example:

aws s3 cp --recursive s3://your_bucket/your_folder_named_x path/to/your/destination
  • Related