Change Content-Disposition of existing S3 object

前端 未结 2 652
一个人的身影
一个人的身影 2020-12-09 19:55

In S3 REST API I am adding metadata to an existing object by using the PUT (Copy) command and copying a key to the same location with \'x-amz-metadata-directive\' = \'

2条回答
  •  鱼传尺愫
    2020-12-09 20:37

    here: this uses the cli to set the content-disposition header on all files in a path inside a bucket (and also sets them as public):

    aws s3 ls s3://mybucket/brand_img/ios/|awk {'print $4'} > objects.txt
    
     while read line; do aws s3api copy-object --bucket mybucket  \
    --copy-source /mybucket/brand_img/ios/$line --key brand_img/ios/$line \
    --metadata-directive REPLACE --metadata Content-Disposition=$line --acl public-read; done < objects.txt
    

提交回复
热议问题