Tagsfromfile: Executing only if tags in xmp are different than in dest (jpg/nef)

Started by mlaverdiere, April 30, 2018, 11:50:00 AM

Previous topic - Next topic

mlaverdiere

Hi,

As I solved some other problems with great help on this forum (see my last day's posts). I'm still facing some issues with my photo library tagging strategy, which is based on a script run by a daily cronjob.

The general idea is to retag dest files (jpg/nef) with their respective source xmp files. Now, I would like this retagging process to occur only if the tags (hierarchicalSubject) in the dest file are different than the tags in the correspondant xmp file.

I'm under the impression that this might be impossible or that if would require to use some tricky diff commands (like way beyond my knowledge...), after having read the following threads on this forum:

https://exiftool.org/forum/index.php/topic,5862.msg28775.html#msg28775

https://exiftool.org/forum/index.php/topic,3276.msg21140.html#msg21140

In case there's something I missed, here is my starting point (i.e. basic command for retagging all my library, without conditions):

exiftool -ext "*" --ext xmp -overwrite_original -tagsfromfile %d%f.%e.xmp -xmp:all -r DIR

Thanks in advance for any idea/help.

Phil Harvey

One thing you could do is to copy hierarchicalSubject from the dest files into a temporary tag in the XMP files, then copy hierarchicalSubject from the XMP file to the dest file if this temporary tag is different than hierarchicalSubject.  This would take two passes, but would be do-able.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

mlaverdiere

Great idea!

Any clue on which temporary tag (category) I should use?

Phil Harvey

You could either create a user-defined tag, or choose some other rarely used list-type tag like XMP-mediapro:UserFields or something.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).