so I have 1000s of files on my s3 bucket. But, the names of the files contain spaces. I want to replace the space with '_' programmatically using boto python. How do I achieve this?
Thanks.
It is not possible to rename objects in Amazon S3.
Instead, you would need to call CopyObject()
to copy the object, and then DeleteObject()
to delete the original object.
Alternatively, here's a cheating method that I use:
="aws s3 mv 's3://bucketname/"&A1&"' s3://bucketname/"&B1
.sh
file, then run the file (preferably on an Amazon EC2 instance to reduce network latency)The AWS CLI aws s3 mv
command will call CopyObject()
and DeleteObject()
.