murtaza sanjeliwala murtaza sanjeliwala - 8 months ago 84
C# Question

How to copy/move object of amazon s3 having multi level childs to destination?

I have to implement copy/move functionality of amazon s3 objects. but in case of objects with multilevel childs i am unable to copy/move all objects.


you can use S3DirectoryInfo.Move and S3DirectoryInfo.Copy methods see the examples below (AWSSDK.Core and AWSSDK.S3 Version code here

AmazonS3Config cfg = new AmazonS3Config();
cfg.RegionEndpoint = Amazon.RegionEndpoint.EUCentral1;//bucket location
string bucketName = "source bucket";
AmazonS3Client s3Client = new AmazonS3Client("your accessKey", "your secretKey", cfg);

S3DirectoryInfo source = new S3DirectoryInfo(s3Client, bucketName, "sourceFolder");
 string bucketName2 = "destination butcket";               
    S3DirectoryInfo destination = new S3DirectoryInfo(s3Client, bucketName2);
// or 

Probably it can help you.