transferring tags based on content

Started by neebah, September 28, 2016, 10:36:25 PM

Previous topic - Next topic

Phil Harvey

I meant the value of the tag.  I want to be able to reproduce this.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

neebah

Oh I see. 

Subject                         : GPS/Manual, OriginalType/JPG, OwnerName/Name, Storage/Digital/06/2005/00001

Phil Harvey

It worked fine for me (note my quoting is different because I'm on a Mac):

> exiftool a.jpg -subject="GPS/Manual, OriginalType/JPG, OwnerName/Name, Storage/Digital/06/2005/00001" -sep ', '
    1 image files updated
> exiftool a.jpg '-xmp:type+<${subject;s/^(.*, )?(.*?Digital.*?)(, .*)?$/$2/ or $_=undef}' -v2
======== a.jpg
Setting new values from a.jpg
Adding XMP-dc:Type
Rewriting a.jpg...
  Editing tags in: APP1 XMP
  Creating tags in: APP1 XMP
JPEG APP1 (310 bytes):
JPEG APP1 (5096 bytes):
  Rewriting XMP
    + XMP-dc:Type = 'Storage/Digital/06/2005/00001'
JPEG DQT (130 bytes):
JPEG SOF0:
JPEG DHT (73 bytes):
JPEG SOS
    1 image files updated


Could your problem perhaps be FAQ 17?

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

neebah

Got it.  Was attempting to use the exiftool direct option in exiftoolgui

neebah

Two more questions on this.  How can I replace the tag with another value (once its found) and how can i simultaneously delete it from the subject tag

Phil Harvey

Replace it in XMP:Subject or XMP:Type?

If you want to copy the existing item to XMP:Type, then replace it in XMP:Subject, the command is:

exiftool -if "$subject =~ /WORD/" "-xmp:type+<${subject;s/^(.*, )?(.*?WORD.*?)(, .*)?$/$2/}" "-xmp:subject-<${subject;s/^(.*, )?(.*?WORD.*?)(, .*)?$/$2/}" "-xmp:subject+=SOMETHING ELSE" DIR

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