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"
The -f (-ForcePrint) option (https://exiftool.org/exiftool_pod.html#f--forcePrint) will replace tags that don't exist with a dash. This can be changed with the -api MissingTagValue option (https://exiftool.org/ExifTool.html#MissingTagValue).
-m (-ignoreMinorErrors) option (https://exiftool.org/exiftool_pod.html#m--ignoreMinorErrors) 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 (https://exiftool.org/forum/index.php?topic=9911.0) for examples of the last two options.
The final options would be to create a user-defined tag to do the combine.
Thank you again StarGeek. Your reply answers my needs. You are saving me perhaps days of work with your replies.