rlib/aws_connection.rb
# Copy an object from one bucket to another (or the same bucket, with a different key)
# @param src_bucket [String] If null, then the current bucket is used
# @param src_key [String] The object to copy
# @param dest_bucket [String] bucket to copy source object to.
# @param dest_key [String] The destination objects key (name)
Copy an object from one bucket to another (or the same bucket, with a different key)
Copy an object from one bucket to another ( or the same bucket with a different key )
def object_copy(src_key:, dest_bucket:, dest_key:, src_bucket: nil)
    begin
      src_bucket ||= @bucket
      @s3_client.copy_object( copy_source: "/#{src_bucket}/#{src_key}", bucket: dest_bucket, key: dest_key, metadata_directive: 'COPY')
    rescue StandardError => e
      puts "object_copy(#{src_bucket},#{src_key},#{dest_bucket},#{dest_key}) : #{e.class} #{e}"
    end
  end
def object_copy ( src_key : , dest_bucket : , dest_key : , src_bucket : nil ) begin src_bucket ||= @bucket @s3_client . copy_object ( copy_source : "/#{src_bucket}/#{src_key}" , bucket : dest_bucket , key : dest_key , metadata_directive : 'COPY' ) rescue StandardError => e puts "object_copy(#{src_bucket},#{src_key},#{dest_bucket},#{dest_key}) : #{e.class} #{e}" end end
Copy an object from one bucket to another (or the same bucket, with a different key)
Copy an object from one bucket to another ( or the same bucket with a different key )
src_key
The object to copy
The object to copy
dest_bucket
bucket to copy source object to.
bucket to copy source object to .
dest_key
The destination objects key (name)
The destination objects key ( name )
src_bucket
If null, then the current bucket is used
If null then the current bucket is used