Renaming files with unique identifier

Hi,
I’m trying to rename some images that I previously rename with ExifTool. For images with he same timestamp it adds a unique number at the end like_001or _002 etc. I’m trying to replicate the same with Digikam and playing with the modifiers but I give up :frowning: I cannot achieve the same.What am I doing wrong? This is the renaming string:

[date:"yyyyMMdd_hhmmss"]_[meta:Exif.Image.Model]_###{unique:3}

Also, if I try the trim modifier to remove the space between NIKON and D80 it doesn´t trim it.

[date:"yyyyMMdd_hhmmss"]_[meta:Exif.Image.Model]{trim}

You’ll see that your {unique} modifier is highlighted in red, it must be placed directly after a function.
Since the “_” is the default, this string would be correct:

[date:"yyyyMMdd_hhmmss"]_[meta:Exif.Image.Model]{unique:3}

Or you can specify the separator:

[date:"yyyyMMdd_hhmmss"]_[meta:Exif.Image.Model]{unique:3,_}

The {trim} modifier only trims spaces at the beginning and end of a function, not inside.
You could solve it with the "{replace} function:

[date:"yyyyMMdd_hhmmss"]_[meta:Exif.Image.Model]{replace:"NIKON ","NIKON"}{unique:3}

Hey Maik thanks a lot, I better understand the syntax now.

However, in this case exiftool will add _000 because there are no images with same timestamp, will digikam add the unique modifier to each image. Is there another modifier that I can use to behave like exiftool?

I added the option to always pad zero digits to the {unique} modifier. This will be available in digiKam-8.2.0. Then this is the example:

[date:"yyyyMMdd_hhmmss"]_[meta:Exif.Image.Model]{unique:3,_,0}

https://invent.kde.org/graphics/digikam/-/commit/d85517faf2f6ce00a232c4dbda6252e99594941c

2 Likes

Maik,
thanks a lot and thanks for your work on digikam. Impressive software.

@dkdeveloper I downloaded the nightly and trying the new modifier.

Here some issues I want to point out. Let me know what do you think and if there is a better solution.

This is the pattern I’d like to apply:

[date:ISO]_[meta:Exif.Image.Model]

I’d like to rename all these pictures and there are some edits (e.g. v1 and v2).
I cannot apply the edit for these 2 files (maybe a possibile solution is to give the user the option to deselect and not apply the rename pattern to those files? IDK)

So I’m trying to apply the pattern you suggested above:

[date:ISO]_[meta:Exif.Image.Model]{unique:3,_,0}

But as you can see it applies to ALL the images. Is there a way to make the unique modifier like in exiftool so that applies only when there is specific need to differentiate the files?

The expected result is like in the first screenshot but when the renamer meet the v1 and v2 file it will change them like:

20060101_151906_K750i_000.jpg -> 2006-01-01T15_19_06_K750i_000.jpg 
20060101_151906_K750i_000_v1.jpg -> 2006-01-01T15_19_06_K750i_001.jpg 
20060101_151906_K750i_000_v2.jpg -> 2006-01-01T15_19_06_K750i_002.jpg  
20060101_1537308_K750i_000.jpg -> 2006-01-01T15_37_08_K750i_000.jpg  ### start from 000.

Thanks.

The idea of modifiers is that they only apply to the last function they are attached to. In the case of the unique modifier, this must not only refer to the camera model, but to the entire string, I will fix it.

1 Like