EXIF date from filename with no standard date format

Started by GNU_Linux, January 24, 2019, 06:31:48 AM

Previous topic - Next topic

GNU_Linux

Hi to everyone.

I have a directory with a large number of files (with no EXIF info) named like this:


P04-22-07_15.08[1].jpg
P04-22-07_15.16.jpg
P04-22-07_15.16[1].jpg
P04-22-07_15.17.jpg
P04-22-07_15.17[1].jpg
P04-22-07_16.18.jpg
P04-22-07_17.58.jpg
P04-22-07_18.00.jpg
P04-22-07_18.00[1].jpg


Date and time are in format mm-dd-yy_HH.MM

I want to add "Date/Time Original" info to all my files. I tried with:
exiftool '-createdate<filename' -d 'P%m-%d-%y_%H.%M' P*.jpg but I gotten this error:
Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in ExifIFD:CreateDate (PrintConvInv)

I use a GNU/Linux distro.

Any ideas?

Many thanks

Phil Harvey

Your command works for me using your example file names and these library versions:

> exiftool -ver -v
ExifTool version 11.26
Perl version 5.018002 (-C0)
Platform: darwin
Optional libraries:
  Archive::Zip                 1.62
  Compress::Zlib               2.06
  Digest::MD5                  2.52
  Digest::SHA                  5.84_01
  IO::Compress::Bzip2          2.060
  POSIX::strptime              0.13
  Unicode::LineBreak           (not installed)
  IO::Compress::RawDeflate     2.060
  IO::Uncompress::RawInflate   2.060


Check your ExifTool and POSIX::strptime version.  Updating to the most recent version of these should fix the problem.

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

GNU_Linux

Quote from: Phil Harvey on January 24, 2019, 08:02:17 AM
...
Updating to the most recent version of these should fix the problem.
...

Thank you Mr. Harvey, I solved.