How to rename files and folder in Amazon S3?

后端 未结 19 2192
暖寄归人
暖寄归人 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:18

    You can either use AWS CLI or s3cmd command to rename the files and folders in AWS S3 bucket.

    Using S3cmd, use the following syntax to rename a folder,

    s3cmd --recursive mv s3://<s3_bucketname>/<old_foldername>/ s3://<s3_bucketname>/<new_folder_name>
    

    Using AWS CLI, use the following syntax to rename a folder,

    aws s3 --recursive mv s3://<s3_bucketname>/<old_foldername>/ s3://<s3_bucketname>/<new_folder_name>
    
    0 讨论(0)
  • 2020-11-28 03:18

    We have 2 ways by which we can rename a file on AWS S3 storage -

    1 .Using the CLI tool -

    aws s3 --recursive mv s3://bucket-name/dirname/oldfile s3://bucket-name/dirname/newfile

    2.Using SDK

    $s3->copyObject(array(
    'Bucket'     => $targetBucket,
    'Key'        => $targetKeyname,
    'CopySource' => "{$sourceBucket}/{$sourceKeyname}",));
    
    0 讨论(0)
  • 2020-11-28 03:22

    In the AWS console, if you navigate to S3, you will see your folders listed. If you navigate to the folder, you will see the object (s) listed. right click and you can rename. OR, you can check the box in front of your object, then from the pull down menu named ACTIONS, you can select rename. Just worked for me, 3-31-2019

    0 讨论(0)
  • 2020-11-28 03:24

    File and folder are in fact objects in S3. You should use PUT OBJECT COPY to rename them. See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html

    0 讨论(0)
  • 2020-11-28 03:25

    This is now possible for Files, select the file then select Actions > Rename in the GUI.

    To rename a folder, you instead have to create a new folder, and select the contents of the old one and copy/paste it across (Under "Actions" again)

    0 讨论(0)
  • 2020-11-28 03:27
    aws s3 cp s3://source_folder/ s3://destination_folder/ --recursive
    aws s3 rm s3://source_folder --recursive
    
    0 讨论(0)
提交回复
热议问题