Monday, 2 September 2013

Not able to download files from S3 bucket?

Not able to download files from S3 bucket?

This is the code i am using to download all the files from my S3 bucket is:
#Download all files from a bucket to a local folder
LOCAL_PATH = "C\\s3\\"
bucket_name = 'unrendered'
# connect to the bucket
bucket = conn.get_bucket(bucket_name)
# go through the list of files
for key in bucket.list():
try:
res = key.get_contents_to_filename(key.name).replace("\\",
"//")
except:
print(key.name+":"+"FAILED")
The files in my S3 buckets are:

The code only downloads the first file, but i cannot download the rest of
the files which have names with directory address included.
Also, when i upload the files on S3 using boto, it does not create
directories it creates files with names of directories included. I know
that s3 is flat data structure, but how can i create folder from the web
interface.

No comments:

Post a Comment