how to mass change folder names in amazon s3 with a script

Friday, July 11, 2014

I uploaded a bunch of images but accidentally named the folders with spaces. Now you can't access them cause obviously urls cant have spaces.


I've downloaded the aws cli and was wondering how to change folder names? I've looked at the documentation but I'm still having trouble and hoping someone can help.


I've tried the below command without any success:


aws s3 mv "s3://mybucketname/firstfolder/second folder with spaces/" s3://mybucketname/firstfolder/secondfolderwithspaces/ --recursive


How do I change the name of "second folder with spaces" to "secondfolderwithspaces"?


Also, is there a way I can iterate through these folders? Something like



for folder in s3:/bucketname/firstfolder:
aws s3 mv "folder with spaces" folderwithspaces --recursive






http://ift.tt/VTV4Pt