murtaza sanjeliwala murtaza sanjeliwala - 1 year ago 121
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download