If anyone has worked with boto I was wondering if you could help. I have this code currently:
from boto.s3.connection import S3Connection
from boto.s3.key import Key
conn = S3Connection(XXX, YYY)
bucket = conn.get_bucket('bucketname')
latest = max(bucket, key=lambda k: k.name)
latest.get_contents_to_filename()
I am confused about two things, and would really appreciate some help:
- Within my bucket I have created directories. How can I make it so this script only looks at a single directory within the bucket, i.e "Photos" not my entire S3 bucket?
- How to specify a download location. The script is designed to grab the latest datetime name'd file from an S3 bucket and download it, but I was wondering if I can specify where it is downloaded to.