How to rename files and folder in Amazon S3?

后端 未结 19 2376
暖寄归人
暖寄归人 2020-11-28 03:01

Is there any function to rename files and folders in Amazon S3? Any related suggestions are also welcome.

19条回答
  •  长情又很酷
    2020-11-28 03:33

    rename all the *.csv.err files in the <>/landing dir into *.csv files with s3cmd

     export aws_profile='foo-bar-aws-profile'
     while read -r f ; do tgt_fle=$(echo $f|perl -ne 's/^(.*).csv.err/$1.csv/g;print'); \
            echo s3cmd -c ~/.aws/s3cmd/$aws_profile.s3cfg mv $f $tgt_fle; \
     done < <(s3cmd -r -c ~/.aws/s3cmd/$aws_profile.s3cfg ls --acl-public --guess-mime-type \
            s3://$bucket | grep -i landing | grep csv.err | cut -d" " -f5)
    

提交回复
热议问题