Author Topic: Write datetimeoriginal to IPTC JPG keywords  (Read 177 times)

Tribo0n

  • Jr. Member
  • **
  • Posts: 11
Write datetimeoriginal to IPTC JPG keywords
« on: March 27, 2019, 05:52:41 AM »
How can i write the datetimeoriginal modeified to the iptc JPG keywords field?
For example datetimeoriginal = 2003:10:31 15:44:19
2003 should be added to keywords and 311003 should be added also
how can i do this?

Thanks a lot
« Last Edit: March 27, 2019, 06:55:44 AM by Tribo0n »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14759
    • ExifTool Home Page
Re: Write datetimeoriginal to IPTC JPG keywords
« Reply #1 on: March 27, 2019, 07:06:06 AM »
Try this:

exiftool -addtagsfromfile @ "-keywords<${datetimeoriginal;s/:.*//}" "-keywords<${datetimeoriginal;s/^\d\d(\d\d):(\d\d):(\d\d).*/$3$2$1/}" DIR

Use +< instead of < if you want to add to existing keywords.

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

Tribo0n

  • Jr. Member
  • **
  • Posts: 11
Re: Write datetimeoriginal to IPTC JPG keywords
« Reply #2 on: March 27, 2019, 08:30:14 AM »
Thanks for help. I use fotostation and the comand line is limited so the script is cut at the end
Code: [Select]
-overwrite_original -addtagsfromfile @ "-keywords+<${datetimeoriginal;s/:.*//}" "-keywords+<${datetimeoriginal;s/^\d\d(\d\d):(\d\d):(\d\d).*/$3$2$1/}"is cutted to
Code: [Select]
-overwrite_original -addtagsfromfile @ "-keywords+<${datetimeoriginal;s/:.*//}" "-keywords+<${datetimeoriginal;s/^\d\d(\d\d):(\Is there a way to abbreviate the script?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14759
    • ExifTool Home Page
Re: Write datetimeoriginal to IPTC JPG keywords
« Reply #3 on: March 27, 2019, 08:34:56 AM »
Sure.

Make a text file containing this:

Code: [Select]
-overwrite_original
-addtagsfromfile
@
-keywords+<${datetimeoriginal;s/:.*//}
-keywords+<${datetimeoriginal;s/^\d\d(\d\d):(\d\d):(\d\d).*/$3$2$1/}

and use this fotostation command:

-@ /path/to/your/file.txt
...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 ($).

Tribo0n

  • Jr. Member
  • **
  • Posts: 11
Re: Write datetimeoriginal to IPTC JPG keywords
« Reply #4 on: March 27, 2019, 08:47:12 AM »
Thanks a lot! Works great!

Tribo0n

  • Jr. Member
  • **
  • Posts: 11
Re: Write datetimeoriginal to IPTC JPG keywords
« Reply #5 on: March 27, 2019, 09:03:55 AM »
Sorry, i saw a mistake now.
If i change the date of the picture in the fotostation and then run the script again, it just add the last value, not the correct picture taken date.
Whats wrong?

Thanks

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14759
    • ExifTool Home Page
Re: Write datetimeoriginal to IPTC JPG keywords
« Reply #6 on: March 27, 2019, 09:06:54 AM »
Is Fotostation changing DateTimeOriginal?  The command I gave should use the value shown with this:

exiftool -datetimeoriginal FILE

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

Tribo0n

  • Jr. Member
  • **
  • Posts: 11
Re: Write datetimeoriginal to IPTC JPG keywords
« Reply #7 on: March 27, 2019, 11:26:25 AM »
my fault. We uses the field DateCreated
i Changed the txt and now it works. thanks