I have some .jpgs that have a dateTimeOriginal but the time is missing. It looks like this:
DSC05177.JPG has date 2016:12:25 20:00:42
DSC05180.JPG has date 2016:12:25 20:01:22
DSC05189.JPG has date 2016:12:25
DSC05190.JPG has date 2016:12:25
DSC05192.JPG has date 2016:12:25
DSC05193.JPG has date 2016:12:25
IMG_4459.JPG has date 2016:12:25 14:45:31
IMG_4463.JPG has date 2016:12:25 14:46:34
I'd like to search for these and update the time, but I can't use -if "not $datetimeoriginal" - it doesn't work because the field is filled in.
Any ideas on how to search for .jpgs that are missing the time?
Thanks!
Lisa
Try this (on mobile so I it may need some tweaks)
-if "not $DateTimeOriginal=~/\d{4}:\d\d:\d\d \d\d:\d\d:\d\d/"
Thanks for responding. That didn't work, though. I'm trying to decipher what might be wrong about it, but I need to research what you're doing there...
Actually hold on, I ran that on the wrong directory! I'll try it again and report back! SORRY!!
YAY! It looks like it worked. Thank you! The expression didn't look wrong to me so I was really stumped at why it didn't work the first time! I forgot I had changed the directory I was in and that directory had no incorrect dateTimeOriginal stamps!
Happy to have helped.
Thank you so much... maybe you can help me with the next step....
Now that I can search for all the files that are missing the time. How can I update JUST the time?
In other words, assume I have a folder filled with .jpgs that all have different DateTimeOriginal but are all missing the time. I want to leave the date part of the DateTimeOriginal in tact, but I just want to update the time to "something", 14:00:00 for instance. Is there an easy way to do this? Something like:
"-DateTimeOriginal<DateTimeOriginal 14:00:00" (which didn't work).
Very, very close. Try
"-DateTimeOriginal<$DateTimeOriginal 14:00:00"
That worked! Thank you!
Next question:
I have a directory named 2018, within that multiple directories naming based on the date and some description like:
2018.01.03 Snow Storm
I want to recurse the 2018 directory looking for any file named "img_1597 amb.jpg" in any directory (also using the -if from earlier in the post) and print some info. (Then I'll use the same thing to change the info. But first I want to just *view* it to make sure the command is not hitting the wrong files.) So I tried this:
exiftool -p "$dateTimeOriginal $filepath" -q -f -if "not $DateTimeOriginal=~/\d{4}:\d\d:\d\d \d\d:\d\d:\d\d/" -r "img_1597 amb.jpg"
That didn't work.
Unfortunately, I'm stuck using Mobile, so it's hard for me to respond, but take a look at this previous answer.
https://exiftool.org/forum/index.php/topic,8096.msg41445.html#msg41445
No worries, it's not urgent by any means.
I did look at that thread and I had started down that path at one point... using another "-if ". I probably was just doing it wrong. I'll give it another go.
Thanks!
You can test the $filename in the -if statement, but that won't be very efficient since ExifTool will extract metadata from all files. It would be better to use something like the Mac/Unix "find" utility to find the file, then pass that name to ExifTool.
You can't use the -fast3 as in the other thread if you want to extract actual metadata from the file.
- Phil