Some time back, I used a piece of software (forgot its name) to modify JPEG images I had on my Windows 10 computer. Unfortunately, this program inserted the incorrect dates and times within the JPEG images. Fortunately, the file names were unchanged so I could potentially recreate the date and time for each JPEG file based on the filename.
So, examples of filename are:
Phạm Lê Chương 20180122_082247.jpg
Phạm Lê Minh Châu 20180122_082614.jpg
etc...
My question is: How can I extract ONLY the date and time- excluding the underscore- from the filenames above and recreate the date and time for these JPEG files?
In case if it's not clear from the above examples, the date/time format shown is YYYYMMDD_HHMMSS.
I'm aware of EXIF parameters like DateTimeOriginal, CreateDate, ModifyDate, etc for JPEG files. However, I don't know the exact command to execute to achieve my goal of recreating the date and time for the files I have on my computer.
Please help.
Thanks for any response.
Regards,
C.
See FAQ #5 (https://exiftool.org/faq.html#Q5), the paragraph starting "Having said this..." Because the filename contains all the date/time info, you just copy the filename into that time related tags you want.
I tried the examples in https://exiftool.org/faq.html#Q5 (https://exiftool.org/faq.html#Q5), but the result is not what I expected. Running the command:
exiftool "-alldates<filename" d:\Test
over the file in "d:\Test" directory:
Phạm Lê Chương 20180122_082247.jpg
changed the file's EXIF date/time metadata to the current date and time when the above command was executed.
This is not what I wanted - I want the date and time from the filename, not the current date and time.
P.S. I'm not using XMP as I don't need it.
Never mind. I figured it out.
I have to run two separate exiftool's commands in order to modify the JPEG files with the correct date/time metadata taken from the filename's date/time value.
Having said that, it would be great if exiftool's creator create an online platform so exiftool's commands could be dynamically tried and tested.
Anyway, as the saying goes: Beggars can't be choosers!
Quote from: chuonglepham on September 15, 2021, 03:29:58 AM
changed the file's EXIF date/time metadata to the current date and time when the above command was executed.
This is not what I wanted - I want the date and time from the filename, not the current date and time.
No, exiftool did not change the EXIF timestamps to the current date and time. It changed them to the time in the filename.
I suspect that this is FAQ #3 (https://exiftool.org/faq.html#Q3). Assuming you're using Windows Properties to look at the files, the EXIF timestamps are listed under "Date Taken" (Right Click->Properties->Details Tab).
(https://i.imgur.com/TegsFiK.png)
The timestamps shown in a directory listing or on the first tab when you hit properties are the
FileCreateDate and
FileModifyDate.
(https://i.imgur.com/76mR7Ah.png)
I'm guessing the command you actually wanted to run would be
exiftool "-FileCreateDate<Filename" "-FileModifyDate<Filename" /path/to/files/