在AmazonS3 Bucket内部处理文件夹(c#)

时间:2016-05-04 13:12:31

标签: c# asp.net-mvc amazon-web-services amazon-s3 amazon

我想将一个文件夹(包含其中的所有现有文件)复制到AmazonS3内的另一个文件夹的同一个Bucket中。

我可以复制一个对象,但我需要的是将包含所有文件的文件夹复制到另一个文件夹中。

2 个答案:

答案 0 :(得分:3)

以下是在AmazonS3 Bucket中复制文件夹的示例。这对我有用。 有关详细信息,请查看此link

source.playbackRate.setTargetAtTime(2, audioCtx.currentTime, 3); // To 2, now, over 3 secs.

答案 1 :(得分:0)

你可以在amazon 3.1.5 .net 3.5这个类的copyTo方法中使用S3DirectoryInfo类。

我使用以下示例C#代码使用C#.net 3.5和amazon版本3.1.5从NTFS文件路径复制到AmazonS3:

   BasicAWSCredentials basicCredentials = new BasicAWSCredentials("your access key", "your secret key");
            AmazonS3Config configurationClient = new AmazonS3Config();
            configurationClient.RegionEndpoint = RegionEndpoint.EUCentral1;
            try
            {
                using (AmazonS3Client clientConnection = new AmazonS3Client(basicCredentials, configurationClient))
                {
                    S3DirectoryInfo source = new S3DirectoryInfo(clientConnection, "sourcebucketname", "sourcefolderkey");
                    S3DirectoryInfo target = new S3DirectoryInfo(clientConnection, "sourcebucketname", "destinationfolderkey");
                    source.CopyTo(target);

                }
            }
            catch(Exception ex)
            {

            }