incrementing keyword tags

Started by neebah, August 14, 2016, 09:22:18 PM

Previous topic - Next topic

neebah

I would like to add an xmp:dc:subject tag for a group of photos by where they are stored in my house.  I would like to automatically increment them with the following

Scanned Binder #1 - 01
Scanned Binder #1 - 02
Scanned Binder #1 - 03
etc.. 

Any command for this. 

Phil Harvey

Yes.

exiftool "-subject+<Scanned Binder #1 - ${FileSequence;$_=sprintf('%.2d',$_+1)}" DIR

Here I have used the sprintf() to format the number as 2 digits and added 1 to start counting from 1.

- 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 ($).

neebah

Thank you.  I just want to check.  Is this workable in Windows or Linux or both. 

Phil Harvey

The quotes are for Windows.  For Linux you must exchange the single and double quotes.

- 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 ($).

neebah

What if I want the first number to start at 980

Phil Harvey

Replace "+1" in the sprintf() call with "+980".

- 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 ($).