As High6 replied, directly renaming s3 is not possible, but its code will not copy all the contents
I added a code snippet that will copy all the content
only works add your passkey and secret key
here is what i did in the code
-> copy the contents of the source folder (sub child element and folders) and paste into the destination folder
-> when copying is complete, delete the original folder
package com.bighalf.doc.amazon; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.List; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3Client; import com.amazonaws.services.s3.model.CopyObjectRequest; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.PutObjectRequest; import com.amazonaws.services.s3.model.S3ObjectSummary; public class Test { public static boolean renameAwsFolder(String bucketName,String keyName,String newName) { boolean result = false; try { AmazonS3 s3client = getAmazonS3ClientObject(); List<S3ObjectSummary> fileList = s3client.listObjects(bucketName, keyName).getObjectSummaries();
}
source share