Copy objects


Example: Copy an Object within the Same Bucket using the s3Client.copyObject() method

AmazonS3 s3Client = new AmazonS3Client();
s3Client.setEndpoint("https://systemname.example.com");

// Copy an object within the same Bucket
s3Client.copyObject( 1
"sample", 2
"myFile.txt", 3
"sample", 4
"myFile.txt.backup" 5
);

1 Copy the Object, passing…
2 The name of the Bucket in which the Object to be copied is stored.
3 The name of the Object being copied from the source Bucket.
4 The name of the Bucket in which the Object to be copied is stored.
5 The new name of the copy of the Object to be copied.

Example: Copy an Object between Two Buckets using the s3Client.copyObject() method

AmazonS3 s3Client = new AmazonS3Client();
s3Client.setEndpoint("https://systemname.example.com");

// Copy an object between two Buckets
s3Client.copyObject( 1
"sample", 2
"myFile.txt", 3
"backup", 4
"myFile.txt" 5
);

1 Copy the Object, passing…
2 The name of the Bucket from which the Object will be copied.
3 The name of the Object being copied from the source Bucket.
4 The name of the Bucket to which the Object will be copied.
5 The name of the copied Object in the destination Bucket.