I want to copy all the data from on bucket to another directory in another bucket on amazon s3 with java.
Like I have a bucket name sourceBucket and a destBucket and there is another directory in destBucket. i want to copy all the data from sourceBucket to that directory. And i am using java. I am unable to find the solution
Try :
ObjectListing objectListing = s3.listObjects(new ListObjectsRequest()
.withBucketName(bucketName)
.withPrefix(""));
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {s3client.copyObject(sourceBucketName, objectSummary.getKey(),
destinationBucketName, objectSummary.getKey());}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments