Download Files from S3 bucket - subfolder - Locally

I am new to terraform i am trying to download all files from a s3bucket with a subfolder with the below code, i am unable to do it, any help on this will be appreciated

data "aws_s3_bucket_objects" "my_objects" {
  bucket = "mybucket"
  prefix = "folder1/newfolder"
data "aws_s3_bucket_object" "object_info" {
  count  = "${length(data.aws_s3_bucket_objects.my_objects.keys)}"
  key    = "${element(data.aws_s3_bucket_objects.my_objects.keys, count.index)}"
  bucket = "${data.aws_s3_bucket_objects.my_objects.bucket}"


 resource "local_file" "foo" {
     count    = length(data.aws_s3_bucket_objects.my_objects.keys)
     content  = data.aws_s3_bucket_object.object_info[count.index].body

filename = "E:\\s3files\\-${count.index}"

Can someone help me to download files with the same file name as in buckets pls

Any help on this please?