Combine 4 Exiftool Commands and not create a copy

Started by michaelw, March 11, 2021, 03:15:37 PM

Previous topic - Next topic

michaelw

I have a series of images taken using a time delay sequence with the camera set to take an image every say 15 seconds.  I want to put a caption on each image showing the date and time, in a variety of formats that the image was taken.  In order to do this I want to use some XMP tags that I would not otherwise use.

I have a series of commands that will do that as shown below.


Using an images IMG_9491 that was taken on 2021 - 02 - 23 at 11:18am

XMP:TransmissionReference (Job Identifier)   Used to Store Date in format 23 February 2021
exiftool -d "%d %B %Y" "-XMP:TransmissionReference<DateTimeOriginal" IMG_9491.jpg
XMP:Instructions -             Used to Store time as 11:18 Hrs
exiftool -d "%H:%M Hrs" "-XMP:Instructions<DateTimeOriginal" IMG_9491.jpg
XMP:Source -                Used to Store Time as 11:18 AM
exiftool -d "%I:%M %p" "-XMP:Source<DateTimeOriginal" IMG_9491.jpg
XMP:Credit -                Used to Store Time as 11:18:40 Hrs or perhaps 11:18.40 hrs
exiftool -d "%H:%M:%S Hrs" "-XMP:Credit<DateTimeOriginal" IMG_9491.jpg
or to display . rather than: before seconds
exiftool -d "%H:%M.%S Hrs" "-XMP:Credit<DateTimeOriginal" IMG_9491.jpg

These work fine, and I am sure that if I change the name of a specific file to *.jpg it would work on all of the .jpg files in a given directory.

However each time I run the command (s) I get a series of backup copies of the originals, which, as I always operate on copies of the original files, I do not need.  As I have to run Exiftool 4 times to populate all of the tags I get 4 lots of backup copies, which I then delete.

I have tried to combine the commands but cannot make it work.

So is it possible to combine the 4 commands and use overwrite original to prevent the backup copies?

If so could someone please help me by providing the correct syntax.

Thanks in anticipation of your assistance

Regards

Michael


Phil Harvey

Hi Michael,

Try this:

exiftool "-XMP:TransmissionReference<${DateTimeOriginal;DateFmt('%d %B %Y)}" "-XMP:Instructions<${DateTimeOriginal;DateFmt('%H:%M Hrs')}" "-XMP:Source<${DateTimeOriginal;DateFmt('%I:%M %p')}" "-XMP:Credit<${DateTimeOriginal;DateFmt('%H:%M.%S Hrs')}" -overwrite_original -ext jpg DIR

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

StarGeek

Edit: Bah, too slow.  Got distracted by free game from Epic Game store

Because you are using multiple date format strings, you'll have to use the DateFmt helper function on each tag rather than a single -d (dateFormat) option.

Also, to suppress the creation of backup files, use the -overwrite_original option.

Try this.  It's formatted for Windows CMD.  Swap single/double quotes if using on a different shell.
exiftool -ext jpg "-XMP:TransmissionReference<${DateTimeOriginal;DateFmt('%d %B %Y')}" "-XMP:Instructions<${DateTimeOriginal;DateFmt('%H:%M Hrs')}" "-XMP:Source<${DateTimeOriginal;DateFmt('%I:%M %p')}" "-XMP:Credit<${DateTimeOriginal;DateFmt('%H:%M:%S Hrs')}" /path/to/files/

Example output:
C:\>exiftool -P -overwrite_original -ext jpg "-XMP:TransmissionReference<${DateTimeOriginal;DateFmt('%d %B %Y')}" "-XMP:Instructions<${DateTimeOriginal;DateFmt('%H:%M Hrs')}" "-XMP:Source<${DateTimeOriginal;DateFmt('%I:%M %p')}" "-XMP:Credit<${DateTimeOriginal;DateFmt('%H:%M:%S Hrs')}" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -XMP:TransmissionReference -XMP:Instructions -XMP:Source -XMP:Credit y:\!temp\Test4.jpg
---- XMP-photoshop ----
Credit                          : 13:18:32 Hrs
Instructions                    : 13:18 Hrs
Source                          : 01:18 PM
TransmissionReference           : 11 March 2021


See Common Mistake #2 for the reason to use the -ext (extension) option rather than wildcard.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

As usual, StarGeek explains things better than I.  :)

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