Recently, I downloaded a large number of photos from a cloud service to my local machine (Ubuntu 23.10). As is expected, the creation/birth date of those files was set to the actual download date. Now, after uploading the photos to a new cloud provider I noticed that my photos are sorted by creation date only (no support for image metadata apparently), which is, of course, pretty useless.
So far, so bad, it certainly isn't a problem of Ubuntu. However, the first (and presumably simplest) solution that came to my mind is to change the files' creation dates according to the respective metadata. Unfortunately, it turns out that changing a files creation date on Linux is not easily done. I don't understand all the details, but it seems to have something to do with the creation date being maintained by the filesystem itself and not usually being exposed to the user. Note: While changing the modification date was no problem using the touch command, it did not solve my problem.
Long story short: The only solution that seems to work is the following:
- Read the metadata timestamp from the image, e.g.
exiftool -T -DateTimeOriginal <file> - Use
timedatectl set-timeto adjust the system time - Copy the image file and delete the old one
I've tried it for individual files and it seems to work flawlessly. However, I'm a bit concerned with actually trying it for a significant number of files automatically. Are there any problems (with performance, precision or otherwise) I should be aware of?
EDIT: After @FedKad's comment I noticed that the files are, in fact, sorted by upload date, not the file creation date. I apologize for not noticing before. Still, I'm going to keep the question, because I believe it is a problem others may find interesting (without the context).
