ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: met077 on December 25, 2020, 01:17:21 PM

Title: Adding Image Unique ID to filenames
Post by: met077 on December 25, 2020, 01:17:21 PM
I use the command exiftool .\ -wm c "-ImageUniqueID<NewGUID#" -overwrite_original -r to add an Image Unique ID to each of my photos. After this I then use either Adobe Bridge or ExifTool to add that Image Unique ID to the last part of the image filename. The only issue I have with this is that the filename ends up quite long.

Is there a way to:

Rename the file using only the last 12 digits of the Image Unique ID (the part that is just a random number)?

Or

Using ExifTool set the Image Unique ID to only the last 12 digits that would normally be created by the create ImageUniqueID command?

Thanks
Title: Re: Adding Image Unique ID to filenames
Post by: StarGeek on December 25, 2020, 01:40:51 PM
Use something like
${NewGUID;m/(.{12}$)/;$_=$1}

Either replace NewGUID# in your above command with this or as part of your rename command.

This uses a RegEx match m/(.{12}$)/ to capture the last 12 characters and sets the value of the tag to be equal to that capture $_=$1