0
\$\begingroup\$

I have a bunch of old photos that uses weird naming convention..like:

dd-mm-yy_HHMM

yyyy-mm-dd HH.MM.SS

yyyymmdd_HHMMSS

and no "Date taken" field on the EXIF infos. Also, creation date is wrong. So what I'd like is to use the filename to set the correct "Date taken" or creation date.

I had no luck with Exiftool or Advanced Renamer..probably I can't still use those tools properly.

What would you do? thanks

\$\endgroup\$
1
  • \$\begingroup\$ Do you know how to program or write batch scripts? You can script the parsing portion and use EXIFTOOL or jhead to write the EXIF data to the file. \$\endgroup\$
    – qrk
    Dec 19, 2021 at 21:07

1 Answer 1

2
\$\begingroup\$

Exiftool would be the best for dealing with these varying formats. You would need to make sure that they're not all in the same directory to avoid mistakes.

The easiest is the "yyyymmdd_HHMMSS" and "yyyy-mm-dd HH.MM.SS" patterns or any variations where the numbers go from year to seconds. As per exiftool FAQ #5, the command would be simply be:
exiftool "-AllDates<Filename" /path/to/files/

In these cases, exiftool will extract the numbers and apply them to the appropriate places in order.

The "dd-mm-yy_HHMM" is a bit more complex, especially if it doesn't contain the seconds. Also, since the year is incomplete, you would have to separate any pictures that may be 19##s from the 20##s. have Your command would be something like:
exiftool "-AllDates<${Filename;s/(\d\d)-(\d\d)-(\d\d)/20$3$2$1/} 00" /path/to/files/

For files that have a 19## year, you would change 20$3$2$1 into 19$3$2$1. This command also defaults to a seconds value of 00.

These commands creates backup files. Add -overwrite_original to suppress the creation of backup files. Add -r to recurse into subdirectories. If this command is run under Unix/Mac/PowerShell, reverse any double/single quotes to avoid bash interpretation.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.