ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: tomasherrmann on June 03, 2018, 04:46:02 PM

Title: pls help on writing origin information as comment
Post by: tomasherrmann on June 03, 2018, 04:46:02 PM
hello,
my *.jpgs contain information about the origins (in ITCP´s "Sub-location"). This information should be placed in the comment field.
I tried a lot  in kind of

exiftool -comment=-Sub-location  src.jpg

but that is obviously wrong - (now the comment is: "-Sub-location" and not the contents of this field) - could you pls help?
thanx


Title: Re: pls help on writing origin information as comment
Post by: StarGeek on June 03, 2018, 05:23:52 PM
You're close.  To copy a tag, you want to use the Greater/Less Than signs </>.  The equal sign assigns a static value.  Also, you only need the dash at the beginning, not on the second tag.

So your command would be:
exiftool "-comment<Sub-location" src.jpg

BUT

This probably won't do what you want it to do.  What program are you using to view "Comment".  If you are using Windows properties, then you actually want to use one of these tags:
EXIF:UserComment
XMP:UserComment
EXIF:XPComment


So try this instead:
exiftool "-XPComment<Sub-location" src.jpg

This command creates backup files.  Add -overwrite_original to suppress the creation of backup files.  Add -r to recurse into subdirectories. 
Title: Re: pls help on writing origin information as comment
Post by: tomasherrmann on June 03, 2018, 06:28:37 PM
great, thank you very much!

surprisingly
exiftool" "-Comment<Sub-location" src.jpg
works with exiftool 3.5 under windows10

May I ask you now for a hint on combining two fields?

~~~ exiftool" "-Comment<Sub-location + " " + city" src.jpg

thank you
Title: Re: pls help on writing origin information as comment
Post by: StarGeek on June 03, 2018, 07:41:09 PM
When copying more than one tag, you have to add a dollar sign in front of the tag name to treat it as a string.  Then you can just combine them with the space between them
exiftool "-comment<$Sub-location $City" src.jpg

If you wanted to add static text as well, you can just place it where you want.  As long as the text doesn't bump up against the end of a tag name, it should work
exiftool "-comment<Location: $Sub-location City: $City" src.jpg
Title: Re: pls help on writing origin information as comment
Post by: tomasherrmann on June 04, 2018, 02:07:40 AM
Thank you so much!