How can I batch-add Lightroom keywords to RAW sidecar XMP files from a text or CSV file using ExifTool?

Asked 6/3/2015

5 views

2 answers

0

I have hundreds of RAW files with sidecar XMP files in multiple folders, and I want to add keywords from a text file without replacing any existing keywords.

My source file currently has two columns:

  • full path/filename
  • keyword list

The fields are tab-delimited, and the keywords in the second column are comma-separated.

Can ExifTool import this data into the XMP sidecars for Lightroom? If so, what format should the file use, and what command would I run?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

11y ago

2 Answers

1

I believe your CSV file will need a couple alterations. First, I don't think Exiftool will read a tab delimited csv. The docs seem to indicate comma separated only. You could import into Excel or OpenOffice with the tab delimiter set and export a new CSV which should be readable to Exiftool.

Second, the first line needs to needs to have column headers indicating the Tags you want to import. The first column needs to be SourceFile. Your second column could be Keywords (for IPTC:Keywords) or Subject (for XMP:Subject). I'd suggest Subject, as that's the more modern standard. I believe LR will read either and will write both.

After that, the command should be something like
Exiftool -sep ", " -csv=/path/to/file.csv /path/to/target/files
If the files are in multiple directories, just add those directories. You can add -r to recurse. Exiftool should only process those files in the CSV file and are included in the command line directories.

The -sep option indicates the value that should be used to separate each item of the keywords.

Further reading
Exiftool docs on -csv
Exiftool FAQ 26, How do I import information from a database?

Originally by user37960. Source · Licensed CC BY-SA 4.0

user37960

11y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes. ExifTool can import keyword metadata from a CSV-style file, but the import file should be a real comma-separated CSV rather than tab-delimited.

Use a CSV with a header row like:

  • SourceFile
  • Subject (preferred XMP keyword field)

Example: SourceFile,Subject /full/path/image1.xmp,"keyword1, keyword2"

Subject is the modern XMP field. Lightroom generally reads Subject, and may also sync with IPTC keywords.

Then run ExifTool with a separator so the comma-separated values are treated as multiple keywords:

exiftool -sep ", " -csv=/path/to/file.csv /path/to/target/files

Notes:

  • Convert your tab-delimited file to CSV first.
  • The first column must be SourceFile.
  • Point SourceFile at the files you want updated, such as the .xmp sidecars.
  • If your files are spread across folders, include full paths in SourceFile and run the command against the relevant parent folder(s).

This is the basic import workflow described in the community answer.

UniqueBot

AI

11y ago

Your Answer