How to get a file from a bucket and then store it in another bucket

Oct 19, 2012 at 8:00 PM
Edited Oct 19, 2012 at 8:01 PM

I would like to know how can I get the a file from a bucket and then store it in another one. I tried the follwing method:

 ///  /// Gets a file object from a bucket, and streams it to disk ///  
 public void GetFileObject(String bucketName, String keyName, String localfile)
 ObjectGetRequest objectGetRequest = new ObjectGetRequest(bucketName, keyName);
ObjectGetResponse objectGetResponse = _service.ObjectGet(objectGetRequest);
objectGetResponse.StreamResponseToFile(localfile); }

But instead of sending it to the disk I would like to stream it some how and re send it but to a different bucket. How can I do this?.
Jun 12, 2014 at 10:59 AM
However this is a late reply but hope it can help someone else. For copying file from one bucket to other use CopyObjectRequest. Sample code below
           CopyObjectRequest request = new CopyObjectRequest
                SourceBucket = BUCKET_NAME,
                SourceKey = backupObjectKey,
                DestinationBucket = BACKUP_BUCKET_NAME,
                DestinationKey = backupObjectKey