Hello community, does anyone know how to use python to get the last modified date for raster dataset? In my case, I have some TIFF files in S3 bucket, which is a cloud storage store. I want to scan folders and identify the newly added TIFF dataset. Instead of using the specific package for aws bucket, is it possible to use arcpy or arcgis api for python to get the modified date from the property headers?
Thanks in advance!
Han
Solved! Go to Solution.
I would lean towards using the boto3 package to get that info. I would assume it's the same as you would get through the metadata, hopefully. There are a couple of ways to do this, but they all pretty much entail getting a "last_modified" attribute.
import boto3
s3 = boto3.client('s3', region_name='your_region')
objects = s3.list_objects(Bucket='your_bucket')
for o in objects["Contents"]:
print(o["LastModified"])
I would lean towards using the boto3 package to get that info. I would assume it's the same as you would get through the metadata, hopefully. There are a couple of ways to do this, but they all pretty much entail getting a "last_modified" attribute.
import boto3
s3 = boto3.client('s3', region_name='your_region')
objects = s3.list_objects(Bucket='your_bucket')
for o in objects["Contents"]:
print(o["LastModified"])