Reputation: 101
I need to move some files (thousands) to Amazon S3 bucket, from where they will be displayed to the end-user by another application (instead of the current one).
Problem is, that these files have creation/upload date now (dates very between 2012 and 2017, when they were uploaded to current application), and when I move them they all start to be of the same date. That is a problem because when you look at the files in the new application, you don't understand the time hierarchy which is sometimes very important.
Is there any way I can modify upload date of a file(s) in S3?
Upvotes: 10
Views: 13917
Reputation: 1008
You can just copy over the same object and the timestamp will update. This technique is also used to prolong the expire of an object in a bucket with a lifecycle rule.
Upvotes: 3
Reputation: 7092
What I did was renaming the file to something else and then renaming it again to its original name. As you cannot rename directly, you have to copy the file to a new name, and then copy it back to its original name. (and delete the auxiliary file, of course) It is not optimal, but that's the solution when using AWS client. I hope one day AWS will have all function the FTP used to have.
Upvotes: 1
Reputation: 269921
The Last Modification Date is generated by Amazon S3 and cannot be set via the API.
If dates and other information (eg user
) are important to your application, you can store it as metadata on the object. Then, retrieve the metadata when displaying dates, user, etc.
Upvotes: 12