cat.zhang
cat.zhang

Reputation: 11

How to get the last modify time for a file in s3 with python boto3?

Just as the title said.How can I use python-boto3 to get the last modify time for a file in amazon-s3? Thanks.

Upvotes: 1

Views: 4930

Answers (1)

mootmoot
mootmoot

Reputation: 13176

In boto3, you can use s3.client.head_object()

this will return a dict of meta data for the particular object. You just need to look into the LastModified element.

'LastModified': datetime(2015, 1, 1)

Upvotes: 2

Related Questions