Provide an example with your answer, otherwise make a comment.
– EternalHourNov 8 '14 at 17:38

29

@EternalHour would be nice.. but it's not necessary.. The question doesn't even have any indication about the language.. so what's the point of doing an example?
– LipisDec 9 '15 at 8:29

36

This is wrong answer. You can move files on S3 using mv. mv = rename
– NicoloApr 12 '16 at 11:12

14

This is a wrong answer for two reasons: 1) you can use the GUI to right click and rename the file, and 2) as it's been mentioned before you can move the file with the move command or through a sdk.
– MaximusMay 31 '16 at 15:11

5

You cannot right click on a folder name to rename it on S3.
– area51Nov 29 '17 at 16:49

To fully mimic renaming (as opposed to copying and then having to delete the original folder), were you able to make the source and target the same? Or you had to make them different, then delete the original folder?
– PydermanSep 7 '15 at 18:07

I think I did a copy then delete the original. From memory I wrote this answer for my own reference - the accepted answer says the same, but didn't give the code example. On the other hand, I'd advise you to have a fresh look through the AWS documents though, because they are evolving new options all the time.
– TomSep 7 '15 at 23:07

There is no way to rename a folder through the GUI, the fastest (and easiest if you like GUI) way to achieve this is to perform an plain old copy. To achieve this: create the new folder on S3 using the GUI, get to your old folder, select all, mark "copy" and then navigate to the new folder and choose "paste". When done, remove the old folder.

This simple method is very fast because it is copies from S3 to itself (no need to re-upload or anything like that) and it also maintains the permissions and metadata of the copied objects like you would expect.

Please consider edit your code as this implementation doesn't return all content, as you implied, 'cause when you call the listObjects(bucketName, keyName), it returns at most 1000 items, you should call ObjectListing.isTruncated() method to know if a new request call is necessary. Consider this as a reference docs.aws.amazon.com/AmazonS3/latest/dev/…
– le0diazNov 2 '18 at 14:25

while some languages don't have an SDK offered by AWS, the big ones (Python, Ruby, Java, C#, PHP, Node.js, Android, iOS, browser JavaScript) do and there's no reason not to use them aws.amazon.com/tools
– Don CheadleMar 4 '15 at 23:00

3

The Java SDK from AWS is too large (and monolithic) for client-side applications.
– Jesse BarnumOct 2 '15 at 14:11

S3DirectoryInfo has a MoveTo method that will move one directory into another directory, such that the moved directory will become a subdirectory of the other directory with the same name as it originally had.

The extension method below will move one directory to another directory, i.e. the moved directory will become the other directory. What it actually does is create the new directory, move all the contents of the old directory into it, and then delete the old one.

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

There is one software where you can play with the s3 bucket for performing different kinds of operation.

Software Name: S3 Browser

S3 Browser is a freeware Windows client for Amazon S3 and Amazon CloudFront. Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. Amazon CloudFront is a content delivery network (CDN). It can be used to deliver your files using a global network of edge locations.

If it's only single time then you can use the command line to perform these operations: