Rubyst
Rubyst

Reputation: 21

How do I copy a file from one folder to another folder in same aws s3 bucket from a rails application?

I need to copy a file from one folder to another folder with new name in same aws S3 bucket. Can anyone have idea how I do it with aws-sdk gem or something else?

Upvotes: 0

Views: 1348

Answers (1)

jpw
jpw

Reputation: 19247

bucket = Aws::S3::Bucket.new('bucketname')

new_object = bucket.object('new_key')
aws_response = new_object.copy_from(bucket.object('source_key'))

Upvotes: 1

Related Questions