Patching exif data

Started by HairyFool, February 23, 2023, 02:57:23 PM

Previous topic - Next topic

HairyFool

I want to import files from my library based on date taken

A number of files from my old iPhone appear to be missing the date taken but the value is in the file name, however the structure is not delimited

ios files.JPG

Can I use the exif tool to populate the Date Taken field from the filename when there are no delimiters? I have seen a couple of errors in the file date so don't want to use that.

Phil Harvey

Are these JPG files? (I assume so.)

If so, I would suggest this command to set DateTimeOriginal from the file name:

exiftool -if 'not $datetimeoriginal' "-datetimeoriginal<filename" -P DIR

This won't update files that already contain a DateTimeOriginal.  I've also added -P to preserve the original filesystem date/time in case it is useful.

But if you want the filesystem date/times updated, do this:

exiftool "-filemodifydate<filename" DIR

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).