Hello, I am processing a big bunch of photos, which will be input into Access for database management. For each image I need to have a unique image ID, however they were lost during exporting from Lightroom.
I would like to know how can I re-edit the ImageUniqueID tag using information from the filename using command lines?
Filename example - 0123_20120324SouthAfrica01SJ0696.jpg
The format of of Unique ID I need - 0123,SouthAfrica,20120324,01
I only started experimenting with -Exif:ImageUniqueID<$filename,SouthAfrica etc etc, but without much success
Is there any way to extract specific strings from the filename and insert into the Unique ID?
Thanks!
Based upon that filename, you could use:
-Exif:ImageUniqueID<${filename;s/(\d{4})_(\d{8})([A-Za-z]+)(\d{2}).*/$1,$3,$2,$4/}
This assumes that all the filenames will follow the same format: 4 digits Underscore 8 digits 1 or more AlphaCharacters 2 digits IgnoredCharacters. Any variation from that format will fail.
This snippet uses the advanced formatting of Exiftool, which makes use of Perl's Regular Expression Substitution. A good place to learn more about regular expressions is regular-expressions.info (http://www.regular-expressions.info) and a good place to test them is regex101.com (http://regex101.com).
Edit: Example of the above on regex101 : https://regex101.com/r/cZ9tF3/1
Thank you Star! It worked like a charm and saved my hundred hours of work from turning into waste.
I will look more into regular expression as you suggested :D
Thanks again!