amazon s3 - python s3 get file without knowing exactly the name file -
i'm using python , boto files amazon s3. i'm uploading format: year/month/filenameyyyymmdd.hhmmss.zip
my problem dont know time (hhmmss) of file. there way it? example:
bucket = awscnx.get_bucket(bucketname) directory = 'year/month/filenameyyyymmdd.*.zip' bucket.list(prefix=directory)
from boto source-code:
def list(self, prefix='', delimiter='', marker='', headers=none, encoding_type=none): """ ... :type prefix: string :param prefix: allows limit listing particular prefix. example, if call method prefix='/foo/' iterator cycle through keys begin string '/foo/'. ...
you can read more in docs
so see no reason why not implement way wrote it, minor change of declaring:
directory = 'year/month/filenameyyyymmdd'
(substituting date pattern correct date of course).
Comments
Post a Comment