How to Upload/download to S3 without changing Last Modified date?

Viewed 2517

I want to upload and download files to S3 using boto3 without changing their "LastModified" date so I can keep tabs on the age of the contents. Whenever I upload or download a file it takes on the date of this operation and I lose the date that the contents were modified.

I'm looking at the timestamp of the files using

fileObj.get('LastModified')

where the fileObj is taken from a paginator result. I'm using the following command to upload

s3Client.upload_fileobj(data, bucket_name, destpath)

and the following to download the files:

s3Client.download_file(bucket_name, key, localPath)

How can I stop the last modified date changing?

1 Answers
Related