python - How to move files between two Amazon S3 Buckets using boto? -
i have move files between 1 bucket pyhton boto api. (i need "cut" file first bucket , "paste" in second one). best way that?
** note: matter if have 2 different access keys , secret keys?
i think boto s3 documentation answers question.
https://github.com/boto/boto/blob/develop/docs/source/s3_tut.rst
moving files 1 bucket via boto copy of keys source destination removing key source.
you can access buckets:
import boto c = boto.connect_s3() src = c.get_bucket('my_source_bucket') dst = c.get_bucket('my_destination_bucket') and iterate keys:
for k in src.list(): # copy stuff destination here dst.copy_key(k.key.name, src, k.key.name) # delete source key k.delete()
Comments
Post a Comment