Merging fields, missing tag stops merge

Started by dwlott, March 16, 2022, 11:36:51 PM

Previous topic - Next topic

dwlott

Hey again,
I am merging some meta and exiftool works great except when a tag is missing which stops the merge from working.  Is there an option or an "if" I can use as a workaround?  I want the merge to still work even if a tag is missing.

e:\exiftool\exiftool "-ImageDescription<$IPTC:City $IPTC:Province-State $IPTC:Country-PrimaryLocationName" "e:\exiftool\mySourceFolder\portraits\LB1020-20.jpg"

StarGeek

The -f (-ForcePrint) option will replace tags that don't exist with a dash.  This can be changed with the -api MissingTagValue option.

-m (-ignoreMinorErrors) option will treat missing tags as empty strings.

The downside to both of these is that if IPTC:Province-State is missing, there will still be the empty space before and after.  So with -f you would have (space)-(space) and with -m you would have (space)(space).

Other options would be to account for all possible combinations and use the fact that later assignments override earlier assignments.  Doable with three, but would make the command long and unwieldy.
Another option would be to create a shortcut tag in .exiftool_config file with all three tags and copy the shortcut tag.  See this thread for examples of the last two options.

The final options would be to create a user-defined tag to do the combine.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

dwlott

Thank you again StarGeek.  Your reply answers my needs.  You are saving me perhaps days of work with your replies.