ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: marcobarrios on August 12, 2018, 11:33:37 AM

Title: Sequence number in tags
Post by: marcobarrios on August 12, 2018, 11:33:37 AM
Hello,

Is there a way to set a tag, for example the title tag, to have a sequence number that is padded with zeros to certain length? For example: "My title 0001", "My title 0002", "My title 0003"...

I managed to set this for the filename by using the command exiftool '-filename=My title %1.4C%lE' but this does not work for any other tags. I could set the title tag to match the filename without the extension by using the command exiftool '-title<${filename;s/.[^.]*$//}' but this needs to be issued in a separate command, otherwise the original filename is used instead. Any help would be highly appreciated, thank you!
Title: Re: Sequence number in tags
Post by: StarGeek on August 12, 2018, 07:09:16 PM
You would have to rewrite the command a bit.  The %1.4C%lE part only works with the Filename and Directory psuedo-tags and can't be directly copied into another tag.  But since you're using %C, I think you could use the FileSequence tag in the rewrite.  Something like
exiftool "-filename<My title ${filesequence;$_=0 x(4-length).($_+1)}%E" "-title<My title ${filesequence;$_=0 x(4-length).($_+1)}"

Test it carefully first, as I'm typing this in a rush as I leave the house.