ExifTool Forum

ExifTool => Newbies => Topic started by: msalisbu on October 14, 2020, 12:13:17 AM

Title: Generate XMP sidecar with rating =5 from a text array
Post by: msalisbu on October 14, 2020, 12:13:17 AM
Was playing around with the tool, and was curious if & how the following would be possible.

Can I read lines of a txt (or some other file) as an input, set the rating, then generate a sidecar xmp with the same filename?

For example, if I'm given a list of photo filenames as text, I want to generate sidecar XMP files for each filename and set the rating to 5 so that I can import it to lightroom, bridge, etc.

Each line of the text file corresponds to a raw image

file1 > set xmp:Rating="5" > write file1.xmp
file2 > set xmp:Rating="5" > write file2.xmp

and so on.

Otherwise I could wrap it around a variable for the source/input & output, but struggling on how to generate an xmp sidecar with xmp:Rating="5" to $filename.xmp.
Is a source image/file required to use exiftool?
Title: Re: Generate XMP sidecar with rating =5 from a text array
Post by: StarGeek on October 14, 2020, 01:57:50 AM
Test this out to see if it's what you want, where /path/to/temp.txt is the path to the text file that has your list of images.
exiftool -rating=5 -srcfile %d%f.xmp -@ /path/to/temp.txt

This uses the -@ (Argfile) option (https://exiftool.org/exiftool_pod.html#ARGFILE) to read the list of files to process, the -srcfile option (https://exiftool.org/exiftool_pod.html#srcfile-FMT) to tell exiftool to write to the xmp file instead of the original file.