I'm trying to upload an entire folder to AWS S3 bucket. I'm successful at uploading individual files, but couldn't find a way to upload the entire folder.
AWS CLI has an option called sync
, does and equivalent methods available in Java SDK?
Sample code for uploading individual objects is as below (only part)
final PutObjectRequest dashboardUploadRequest = PutObjectRequest.builder()
.bucket(aws.getApplihealthReportBucket())
.key(projectName + "/"+ executionConfig.getTestType() +"/" + aws.getS3Folder() + "/index.html").build();
S3Client s3 = S3Client.builder().credentialsProvider(credentialsProvider).build()
s3.putObject(dashboardUploadRequest, Paths.get(resultsDirectory + "/extent.html"));
aws s3 sync
command is a Python program that loops through each file and copies each file individually. There is no AWS API for copying multiple files in one call. – John Rotenstein