How to rename files and folder in Amazon S3?

How to rename files and folder in Amazon S3?

I just tested this and it works:

aws s3 --recursive mv s3://<bucketname>/<folder_name_from> s3://<bucket>/<folder_name_to>

There is no direct method to rename a file in S3. What you have to do is copy the existing file with a new name (just set the target key) and delete the old one.

How to rename files and folder in Amazon S3?

aws s3 cp s3://source_folder/ s3://destination_folder/ --recursive
aws s3 rm s3://source_folder --recursive

Leave a Reply

Your email address will not be published.