0

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?

Rubyst
  • 21
  • 2
  • 1
    https://stackoverflow.com/questions/3459177/how-to-copy-file-across-buckets-using-aws-s3-gem did you checked this link? – Sachin R Aug 31 '17 at 07:32
  • Yes, I have already checked this actually i want to copy a file from one folder to another folder with new name in same bucket – Rubyst Aug 31 '17 at 08:02

1 Answers1

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

new_object = bucket.object('new_key')
aws_response = new_object.copy_from(bucket.object('source_key'))
jpw
  • 18,697
  • 25
  • 111
  • 187