我怎样才能获得S3对象与博托最后修订日期时间? [英] How can I get last modified datetime of S3 objects with boto?

查看:127
本文介绍了我怎样才能获得S3对象与博托最后修订日期时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个Python脚本上传文件使用博托到S3。我想只上传修改过的文件,我可以检查它的最后修改日期时间。但我不能找到API来获取最后的修改博托API。

I'm writing a python scripts to upload files to s3 using boto. I want to only upload changed files which I can check by it's last modified datetime. But I can't find the api to get the last modify in boto API.

推荐答案

下面是Python的/博托code片段,将打印所有键的last_modified属性的斗​​:

Here's a snippet of Python/boto code that will print the last_modified attribute of all keys in a bucket:

>>> import boto
>>> s3 = boto.connect_s3()
>>> bucket = s3.lookup('mybucket')
>>> for key in bucket:
       print key.name, key.size, key.last_modified
index.html 13738 2012-03-13T03:54:07.000Z
markdown.css 5991 2012-03-06T18:32:43.000Z
>>>

这篇关于我怎样才能获得S3对象与博托最后修订日期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆