Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.

Started by sjw, November 13, 2023, 08:18:53 AM

Previous topic - Next topic

sjw

Hi, could you please tell me the exiftool command to populate the FileModifyDate, FileCreateDate, DateTimeOriginal, CreateDate and ModifyDate (-alldates) tags for a file named like 20160825_180532.jpg ?  Use of -overwrite_original is fine.
Many thanks!

Phil Harvey

exiftool "-alldates<filename" "-filemodifydate<filename" "-filecreatedate<filename" FILE

- 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 ($).

sjw


Phil Harvey

Yes.  ExifTool applies some smarts when writing date/time values (see FAQ 5).

- 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 ($).

sjw

Thanks again.
I assume the exact same command would work if the same named files had prefixes of IMG_ for example yes?

StarGeek

Yes.  All you need is the 14 numbers for the full date/time in the correct sequence without any numbers preceding them.  All other characters will be ignored.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

sjw

Many thanks again!
If I wish to recursively scan sub folders I can add -r.  How do I make it only consider jpg files?
-r pathname/*.jpg isn't quite right.

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).