renaming question...

Post Reply
fbungarz
Posts: 1584
Joined: 08 Dec 06 5:03
Location: Arizona, USA

renaming question...

Post by fbungarz » 29 Sep 20 0:46

I have rather naively tried to use rename a bunch of files using a macro, and the result was a complete mess that forced me to restore the files from backup.

Here is what I do want to achieve:

I three versions of the same file, triplets of JPEG, NEF & DNG, all part of one and the same version set, occasionally an additional print version.
They are named like this: prefix_sequencenumber.extension, e.g.:
...
FB_0123.JPG
FB_0123.NEF
FB_0123.DNG

FB_0124.JPG
FB_0124.NEF
FB_0124.DNG

FB_0125.JPG
FB_0125_print.JPG
FB_0125.NEF
FB_0125.DNG

FB_0126.JPG
FB_0126.NEF
FB_0126.DNG

Now these files have a barcode embedded in their xmp metadata, e.g., ASU0069276, ASU0067246.
Triplet 1 & 2 correspond to a specimen with one barcode, the next triplet to a different specimen. Meaning I took several images for one barcode, others images that correspond o a different barcode.
I tried to rename the files using that barcode plus a unique sequence number, like this:
...
ASU0069276-001.jpg
ASU0069276-001.NEF
ASU0069276-001.DNG

ASU0069276-002.jpg
ASU0069276-002.NEF
ASU0069276-002.DNG

ASU0067246-001.JPG
ASU0067246-001_print.JPG
ASU0067246-001.NEF
ASU0067246-001.DNG

ASU0069276-003.jpg
ASU0069276-003.NEF
ASU0069276-003.DNG

I thought this renaming rule would do the job:

Code: Select all

%xmp:dwc:Occurrence.dwc:catalogNumber%ImageNumber{offset=1;length=3;increment=1;reset=never}.%FileExtension
The first part, I assumed, would pull the Barcode number from the XMP field, then the second part add a sequence number...
Well, this resulted in a complete mess.

Any suggestions?

Hert
Posts: 6363
Joined: 13 Sep 03 7:24

Re: renaming question...

Post by Hert » 29 Sep 20 21:56

One of the files had a “print” suffix in its name while your rename rule doesn’t show any signs of that. In other words; that rename rule can never lead to the examples you show.

You can’t use sequence number if you don’t want a sequence number. Sequence numbers will increment for every file but in your example list the number is fixed for a few files and then increments and holds again before incrementing again.

A rule for your files would require scripting as there apparently are rules when a sequence number can increment. But that may be too advanced for a novice.

Personally I would use a rename rule to replace FB_ with your macro. Then in a second step replace the numbers with a new number.
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

fbungarz
Posts: 1584
Joined: 08 Dec 06 5:03
Location: Arizona, USA

Re: renaming question...

Post by fbungarz » 30 Sep 20 2:38

Personally I would use a rename rule to replace FB_ with your macro. Then in a second step replace the numbers with a new number.
OK, I will try that out on a sample...

Hert
Posts: 6363
Joined: 13 Sep 03 7:24

Re: renaming question...

Post by Hert » 01 Oct 20 15:49

Today build 3163 was released (download and install from website).
This build now offers an extra parameter: Skip. This parameter can be helpful for you.

Your rename rule would then become:

Code: Select all

%xmp:dwc:Occurrence.dwc:catalogNumber%ImageNumber{offset=1;length=3;increment=1;skip=samefilename;reset=never}.%FileExtension
This means that no number increment takes place when the filename to rename is the same as that from the previous file.
ImageNumberSkip.png
ImageNumberSkip.png (25.67 KiB) Viewed 364 times
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

fbungarz
Posts: 1584
Joined: 08 Dec 06 5:03
Location: Arizona, USA

Re: renaming question...

Post by fbungarz » 14 Oct 20 18:38

Hi Hert,
this is great. Thanks for implementing it. I have not yet had the time to try it out, but it seems this is exactly what I need.
Thanks again,
Frank

Post Reply