Author Topic: Assign a value to DateTimeOriginal  (Read 1343 times)

HiTechHiTouch

  • Newbie
  • *
  • Posts: 5
Assign a value to DateTimeOriginal
« on: December 17, 2013, 08:09:16 AM »
Forgive me, but I've been up all night and can't figure this out.

I have some jpg files which do not have any exif:DateTimeOriginal value (as shown by exiftool -s).  My idea is to pick FileModifyDate and shove it into DateTimeOriginal.

My command:

exiftool -P -ext jpg -if "not $DateTimeOriginal" -d `"%Y:%m:%d %H:%M:%S"`  -DateTimeOriginal=\"${FileModifyDate}\"  Q*

My result:
Code: [Select]
  Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in ExifIFD:DateTimeOriginal (PrintConvInv)
  Nothing to do.

Altering the command in an attempt to print the operand:

exiftool -P -ext jpg -if "not $DateTimeOriginal" -d `"%Y:%m:%d %H:%M:%S"`  -p  -DateTimeOriginal=\"${FileModifyDate}\"  Q*

My result:

Code: [Select]
-DateTimeOriginal="2013:12:17 06:56:48"
Help, please?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16899
    • ExifTool Home Page
Re: Assign a value to DateTimeOriginal
« Reply #1 on: December 17, 2013, 08:19:49 AM »
ExifTool uses the = operator for assigning simple values.  To copy one tag to another, use < instead.  See the Copying Examples section of the documentation (but note you must use double quotes instead of single quotes if you are in Windows).

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

HiTechHiTouch

  • Newbie
  • *
  • Posts: 5
Re: Assign a value to DateTimeOriginal
« Reply #2 on: December 17, 2013, 08:30:28 AM »
This works:

exiftool -P -ext jpg -if "not $DateTimeOriginal"   "-DateTimeOriginal<FileModifyDate"  Q*

Tried something similar earlier this AM, but redirection got me.  Thanks for the reminder about the quotes.
« Last Edit: December 17, 2013, 09:26:58 AM by HiTechHiTouch »