I\'d like to copy some files from a production bucket to a development bucket daily.
For example: Copy productionbucket/feed/feedname/date to developmentbucket/feed/
.NET Example as requested:
using (client)
{
var existingObject = client.ListObjects(requestForExisingFile).S3Objects;
if (existingObject.Count == 1)
{
var requestCopyObject = new CopyObjectRequest()
{
SourceBucket = BucketNameProd,
SourceKey = objectToMerge.Key,
DestinationBucket = BucketNameDev,
DestinationKey = newKey
};
client.CopyObject(requestCopyObject);
}
}
with client being something like
var config = new AmazonS3Config { CommunicationProtocol = Protocol.HTTP, ServiceURL = "s3-eu-west-1.amazonaws.com" };
var client = AWSClientFactory.CreateAmazonS3Client(AWSAccessKey, AWSSecretAccessKey, config);
There might be a better way, but it's just some quick code I wrote to get some files transferred.