Boto3/S3: Renaming an object using copy_object

后端 未结 3 1319
鱼传尺愫
鱼传尺愫 2020-12-12 23:35

I\'m trying to rename a file in my s3 bucket using python boto3, I couldn\'t clearly understand the arguments. can someone help me here?

What I\'m planing is to copy

3条回答
  •  旧时难觅i
    2020-12-13 00:15

    I found another solution

    s3 = boto3.resource('s3')
    s3.Object('my_bucket','new_file_key').copy_from(CopySource='my_bucket/old_file_key')
    s3.Object('my_bucket','old_file_key').delete()
    

提交回复
热议问题