Replacing a string in XMP and IPTC metadata fields

Started by kennedyk, May 17, 2017, 12:13:00 PM

Previous topic - Next topic

kennedyk

We have a group of TIFF and PDF files to which I already appended metadata using the EXIF tool.  However, we now need to replace a string that appears in several parts of the metadata.  The string appears in the iptc:keywords, xmp:subject, iptc:source and xmp:source fields.  It is not the only keyword and it is part of a longer string in the source field.  We want everything to remain the same except for this string replacement.  We took at look at this previous posting (https://exiftool.org/forum/index.php/topic,8056.msg41200.html#msg41200) but this situation is a little different.

To give more context, here is the contents of that .bat file we used to append the metadata:

exiftool
-creator=
-title=
-description=
-copyright=
-make="Bookeye"
-model="3"
"-creator=Digitized by MIT Libraries Scanning Lab"
"-iptc:source=MIT Bulletin 2004-2005, volume 140, number 1, Collection AC0586, Massachusetts Institute of Technology, Institute Archives and Special Collections, Cambridge, MA"
"-xmp:source=MIT Bulletin 2004-2005, volume 140, number 1, Collection AC0586, Massachusetts Institute of Technology, Institute Archives and Special Collections, Cambridge, MA" "-iptc:keywords+=39080024066331"
"-xmp:subject+=39080024066331"
"-iptc:keywords+=MIT"
"-xmp:subject+=MIT"
"-iptc:keywords+=course catalogs"
"-xmp:subject+=course catalogs"
"-iptc:keywords+=AC0586"
"-xmp:subject+=AC0586"
"-transmissionreference=2017.004RR"
-m -r -ext .TIF -overwrite_original -ext .PDF %1

AC0586 is what needs to be replaced. 

Does anyone have any ideas of how to go about this?  Thanks in advance for your help! 


StarGeek


Test this command to see if it work for you.  Replace New String with your replacement text.

exiftool -api "Filter=s/AC0586/New String/" -tagsfromfile @ -iptc:keywords -xmp:subject -iptc:source -xmp:source FileOrDir

This will rewrite every file even if there isn't a change.  But since your Bat file includes the AC0586 for every file, I would think that every file would have it.  If this isn't the case, you can add this to the above command to process only files that would be changed.
-if "$iptc:keywords# ne $iptc:keywords or $xmp:subject# ne $xmp:subject or $iptc:source# ne $iptc:source or $xmp:source# ne $xmp:source"
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

kennedyk