[ACCEPTED]-AWS::S3 rename a folder-amazon-s3

Accepted answer
Score: 33

The documentation for AWS::S3 explains this pretty well. When storing 11 files on s3, there are no such things as 10 folders. There is a bucket (your APP_CONFIG[:s3_bucket] presumably), and 9 there are objects. That is it. There are 8 no folders. One of your objects might be 7 named /files/public/system/whatever/derp.jpg - but there are no folders there, only 6 an object with a name that looks like a 5 path, and then the value of the object (the 4 actual file residing at that location).

So 3 to answer your question, you cannot rename 2 folders because there is no such thing on 1 s3. You have to rename individual objects.

Score: 4

You can copy objects from one s3://[path_1] to another 2 s3://[path_2] via AWS Console. https://docs.aws.amazon.com/cli/latest/reference/s3/mv.html

Example move objects between 1 different buckets:

aws s3 mv s3://[s3-name1]/folder1 s3://[s3-name2]/[folder2] --recursive 

or within the same S3

aws s3 mv s3://[s3-name1]/folder1 s3://[s3-name1]/[folder2] --recursive 
Score: 1

The easiest way to rename the folder in 10 S3 bucket is open AWS CLI https://docs.aws.amazon.com/cli/latest/userguide/ or AWS Cloud 9 Shell https://aws.amazon.com/cloudshell/

The benefit with AWS cloud shell is 8 that no need to configure, CloudShell is 7 pre-authenticated with your console credential. (Note-- This 6 service launch yesterday)

aws s3 --recursive 5 mv s3:///<folder_name_from> s3:///<folder_name_to>

See 4 the example below, where I change the name 3 of the folder "firstname" to "first" folder. Also, this 2 command move all the object inside that 1 new folder from the older folder.

enter image description here

Score: 0

You cant do this because AWS pricing for 3 every request. So they want to more action. Rename 2 folder or delete will not work. Before you 1 must move / delete etc all files.

More Related questions