It seems, I have a bit of a problem with understanding, when I have to set correctly a ' or a " or a $ to point to a tag. Also it is a little bit unclear, when to use < and when =.
May you please help me to correct this command line, so that it works?
I am trying to write keywords and spaces or words without $ should be a text and all with leading $ should refer to a field.
-sep ", " -m "-Keywords=All,All Sync %ETV%,$CountryCode,$Country,$State,$City,$Location,$SupplementalCategories,$ISO,$Make $Model $BodySerialNumber,$Lens $MakeLensModel $LensSerialNumber,$ImageWidthx$ImageHeight,$FileType,f/$FNumber,$GPS:GPSAltitude $GPS:GPSAltitudeRef,$GPS:GPSLatitudeRef latitude,$GPS:GPSLongitudeRef longitude,Orientation $Orientation,Flash $Flash,Focal Length $FocalLength,$ShutterSpeed s,GPS Speed $GPS:GPSSpeed $GPS:GPSSpeedRef,Orientation $Orientation,Software $Software,Exif Version $ExifVersion,$Regionname"
As a plus it should check, if this tags are already written and only add them, if they are not there. I had no luck with NoDupe so far.
Thank you for your effort!
The "=" writes a literal string value to a tag.
The "<" copies (redirects) the values of other tags (which may be embedded in a string with leading "$" symbols).
On Windows, you need double quotes around the "<". On Mac/Linux you must use single quotes around any "$" symbol.
And see FAQ 17 (https://exiftool.org/faq.html#Q17) for how to prevent duplicate entries.
So your command would look something like this (on Windows):
-sep ", " -m -addtagsfromfile @ "-Keywords-<All,All Sync %ETV%,$CountryCode,$Country,$State,$City,$Location,$SupplementalCategories,$ISO,$Make $Model $BodySerialNumber,$Lens $MakeLensModel $LensSerialNumber,$ImageWidthx$ImageHeight,$FileType,f/$FNumber,$GPS:GPSAltitude $GPS:GPSAltitudeRef,$GPS:GPSLatitudeRef latitude,$GPS:GPSLongitudeRef longitude,Orientation $Orientation,Flash $Flash,Focal Length $FocalLength,$ShutterSpeed s,GPS Speed $GPS:GPSSpeed $GPS:GPSSpeedRef,Orientation $Orientation,Software $Software,Exif Version $ExifVersion,$Regionname" "-Keywords+<All,All Sync %ETV%,$CountryCode,$Country,$State,$City,$Location,$SupplementalCategories,$ISO,$Make $Model $BodySerialNumber,$Lens $MakeLensModel $LensSerialNumber,$ImageWidthx$ImageHeight,$FileType,f/$FNumber,$GPS:GPSAltitude $GPS:GPSAltitudeRef,$GPS:GPSLatitudeRef latitude,$GPS:GPSLongitudeRef longitude,Orientation $Orientation,Flash $Flash,Focal Length $FocalLength,$ShutterSpeed s,GPS Speed $GPS:GPSSpeed $GPS:GPSSpeedRef,Orientation $Orientation,Software $Software,Exif Version $ExifVersion,$Regionname"
Here I have had to specify -addTagsFromFile to be able to combine two copy operations on the same list-type tag.
- Phil
perfect. thank you so much! it works :-)
and how can i write the year from datetimeoriginal in the format YYYY as a keyword?
add -d %Y to your command and use "$datetimeoriginal" in your string.
- Phil
-d "%%Y%%m%%d %%H%%M%%S" is used in the same command to rename the file.
Then use ${datetimeoriginal#;s/:.*//} in your string.
- Phil
Thank you! Is there a function like PROPER() which capitalizes the first character in each word of a string?
For an individual tag, you could do this in the string: ${TAG;s/\b([a-z])/\u$1/g}
- Phil
that is a very easy to remember syntax.
may i ask you, how i could combine and's and or's?
how can i optimize this syntax (or that it works at all)?
-if "$Filename =~ /1S/i and ($SupplementalCategories =~ /R1102/i OR $SupplementalCategories =~ /R1170/i OR $SupplementalCategories =~ /R1103/i OR $SupplementalCategories =~ /R89052/i OR $SupplementalCategories =~ /R89110/i OR $SupplementalCategories =~ /R89129/i OR $SupplementalCategories =~ /R89130/i OR $SupplementalCategories =~ /R89145/i)"
I played around with your data and Regexp::Assemble (http://search.cpan.org/dist/Regexp-Assemble/lib/Regexp/Assemble.pm) and it comes up with
(?:R(?:89(?:1(?:[13]0|29|45)|052)|11(?:0[23]|70)))
So you could use
-if "$Filename =~ /1S/i and $SupplementalCategories =~ /(?:R(?:89(?:1(?:[13]0|29|45)|052)|11(?:0[23]|70)))/i"
Regex101 example (https://regex101.com/r/Xc7kaX/1)
i would love to understand this at some point, but this seems to pretty difficult or add new codes, as these were just examples and i need to add around 15 more job codes.
with the link you provided, a new regex will be created?
i added some codes, but the regex code did not update.
Quote from: irinaonline on June 20, 2017, 06:03:22 PM
i would love to understand this at some point, but this seems to pretty difficult or add new codes, as these were just examples and i need to add around 15 more job codes.
Yeah, it's would be very difficult to add new stuff to that. That answer was compiled specifically for the data you gave. As for understanding, if you follow the link, in the upper right it gives a step by step breakdown, but it requires you know something about RegEx first.
Quotewith the link you provided, a new regex will be created?
No, it just shows an example of what it matches.
If you want something that you can extend, try this:
-if "$Filename =~ /1S/i and $SupplementalCategories =~ /R1102|R1103|R1170|R89052|R89110|R89129|R89130|R89145/i"To add more codes, add a pipe charcter
| and then the new code. For example, if your new code was
R89177 then you would end up with
-if "$Filename =~ /1S/i and $SupplementalCategories =~ /R1102|R1103|R1170|R89052|R89110|R89129|R89130|R89145|R89177/i"
this looks far better and easier to read and maintain. thank you very much for your time!