Help making command please

Started by martin0121, October 03, 2021, 09:25:58 AM

Previous topic - Next topic

martin0121

Hi all,
Total Noob here just trying to get my head round the command possibility.

I have sets of files with a set pattern structure... which in old RegEx would read as %1 %2 %3 %4 %5 %6 %7 %8 %9.jpg, some parts are standardised and some are unique, some are mixed alpha numeric. so a whole mixed bag, but the pattern remains the same. example file name ... LAUD 0062 Sam Smith 5S1 2021 1706469N364Q 75B94 6395.jpg

My question is this... does anyone know of a way to have parts of this file name written into tags in one command? ie....
%3 %4 %5 written to the "Description" Tag
&1 %2 written to the "City" Tag
%8 written to the "Country" tag
%9 written to the "Source" tag

all at the same time....

Any help would be appreciated.

Phil Harvey

This is one possible way to do it, but this isn't for the faint of heart since it uses some slightly advanced Perl techniques:

exiftool "-description<${basename;my @a=split;$_=join ' ',@a[3,4,5]}" "-city<${basename;my @a=split;$_=join ' ',@a[1,2]}" "-country<${basename;my @a=split;$_=$a[8]}" "-source<${basename;my @a=split;$_=$a[9]}" FILE

There may be easier ways to do this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).