ExifTool Forum

ExifTool => Newbies => Topic started by: Tribo0n on March 27, 2019, 05:52:41 AM

Title: Write datetimeoriginal to IPTC JPG keywords
Post by: Tribo0n 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
Title: Re: Write datetimeoriginal to IPTC JPG keywords
Post by: Phil Harvey 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
Title: Re: Write datetimeoriginal to IPTC JPG keywords
Post by: Tribo0n 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?
Title: Re: Write datetimeoriginal to IPTC JPG keywords
Post by: Phil Harvey 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
Title: Re: Write datetimeoriginal to IPTC JPG keywords
Post by: Tribo0n on March 27, 2019, 08:47:12 AM
Thanks a lot! Works great!
Title: Re: Write datetimeoriginal to IPTC JPG keywords
Post by: Tribo0n 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
Title: Re: Write datetimeoriginal to IPTC JPG keywords
Post by: Phil Harvey 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
Title: Re: Write datetimeoriginal to IPTC JPG keywords
Post by: Tribo0n on March 27, 2019, 11:26:25 AM
my fault. We uses the field DateCreated
i Changed the txt and now it works. thanks