Generate XMP sidecar with rating =5 from a text array

Started by msalisbu, October 14, 2020, 12:13:17 AM

Previous topic - Next topic

msalisbu

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?

StarGeek

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 to read the list of files to process, the -srcfile option to tell exiftool to write to the xmp file instead of the original file.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).