ExifTool Forum

ExifTool => Newbies => Topic started by: sjw on November 13, 2023, 08:18:53 AM

Title: Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.
Post by: sjw on November 13, 2023, 08:18:53 AM
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!
Title: Re: Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.
Post by: Phil Harvey on November 13, 2023, 08:25:54 AM
exiftool "-alldates<filename" "-filemodifydate<filename" "-filecreatedate<filename" FILE

- Phil
Title: Re: Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.
Post by: sjw on November 13, 2023, 08:31:23 AM
Many thanks Phil - I was waaaay overthinking it! :)
Title: Re: Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.
Post by: Phil Harvey on November 13, 2023, 08:33:56 AM
Yes.  ExifTool applies some smarts when writing date/time values (see FAQ 5 (https://exiftool.org/faq.html#Q5)).

- Phil
Title: Re: Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.
Post by: sjw on November 13, 2023, 08:40:58 AM
Thanks again.
I assume the exact same command would work if the same named files had prefixes of IMG_ for example yes?
Title: Re: Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.
Post by: StarGeek on November 13, 2023, 08:45:41 AM
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.
Title: Re: Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.
Post by: sjw on November 13, 2023, 09:08:43 AM
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.
Title: Re: Overwriting EXIF and File info from filenames in YYYYMMDD_HHMMSS format.
Post by: StarGeek on November 13, 2023, 09:35:10 AM
Use the -ext (-extension) option (https://exiftool.org/exiftool_pod.html#ext-EXT---ext-EXT--extension).