Hello,
I recently learn thanks to this forum how to rename pictures without GPS coordinates.
Then, I may manually add a location, so files named with "_NOGPS" have coordinates.
I know how to find those files
exiftool -if "$filename=~/NOGPS/" -if "not $gpslatitude" -sourcefile .
but how to rename them? as they have now gps coordinates, P1234567_NOGPS.JPG should be P1234567.JPG
is it possible to perform this operation with exiftool ?
thanks in advance
Maybe something like this?:
exiftool -if "$filename=~/NOGPS/ and $gpslatitude" "-testname<${filename;s/_NOGPS//}" DIR
If this does what you want, then replace "testname" with "filename" to actually do the renaming.
- Phil
Wonderful , according my first test, it is doing what I want ! Thanks a lot !
I do not well understand the syntax : ;s/_NOGPS//
;s for suppress ?
/_NOGPS/ is the string to be deleted
but what about the last / ?
once again, thanks for the help !
s/_NOGPS// is a Regular Expression (RegEx) substitution. The s is for substitution, there is also m for a simple match. The characters between the first two slashes is the pattern that is being searched for, in this case _NOGPS. The pattern between the second two slashes is what will be substituted, in this case, nothing. It is basically s/SearchTerm/Replacement/.
RegEx is very complicated and very powerful. Teaching all the details really is beyond the scope of this forum. There are a lot of websites out there that can teach you about it if you're interested, such as Regular-Expressions.info (https://www.regular-expressions.info/), which is the site I learned from. But as long as you keep to simple alphanumeric characters (a-z, 0-9), you can easily do removal and replacements with exiftool. But other symbols, such as the dot . or asterisk * have different meanings.
thanks, i will try to learn RegEx.