python - How can I download all files from Amazon S3 that are in a folder that was created last month? -


how can download folder amazon s3 created last month until present?

i have code using boto:

for key in bucket.list():    if last_month < dateutil.parser(key.last_modified).month:       key.get_contents_to_filename(local_path + key.name) 

the problem loop take long time because it's comparing each file in folder. want compare folder timestamp.

if there's way using aws cli better.

this not possible.

amazon s3 not use directories. flat storage structure.

to give appearance of directories, paths prepended key (filename) of object (file).

for example, object called cat.jpg stored in directory called animals have key (filename) of animals/cat.jpg.

since directories not exist, there no way retrieve properties directory.

(btw, there concept of "common prefixes" can work directories when referring multiple files, still isn't actual directory.)


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -