Page 1 of 1

Can autonumber be made to reset when certain text differs?

PostPosted: Tue Sep 27, 2016 1:49 pm
by Rairhorns
Hi,
I'm fairly new to Bulk Rename, but i've been working my way though the forum trying to come up with something a little complicated. In short, i need to add an incrementing autonumber after a hyphen, which resets when the text before it changes. For example:

Currently my files look like this:
    BRUIEW-intro1
    BRUIEW-intro2
    BRUIEW-example1
    BRUIEW-example2
    BRUIWXXY-intro1
    BRUIWXXY-example1
    BRUIWXXY-example2
    BRUIWXXY-example3
    BRUIWXXY-example4

But they need to look like this:
    BRUIEW-01-intro1
    BRUIEW-02-intro2
    BRUIEW-03-example1
    BRUIEW-04-example2
    BRUIWXXY-01-intro1
    BRUIWXXY-02-example1
    BRUIWXXY-03-example2
    BRUIWXXY-04-example3
    BRUIWXXY-05-example4

It's been puzzling me for some time, and i've got many thousands of files that'll need renaming in this way.
Any ideas would be great!

Re: Can autonumber be made to reset when certain text differs?

PostPosted: Thu Sep 29, 2016 5:49 pm
by KenP
Try this.

Numbering (10)
Mode: Suffix
Start: 1
Pad: 2
Sep: -
Break: 5

Rename
Reset

The file names should now have the numbers appended at the end of the file name, e.g. BRUIEW-intro1-01.

To move the added numbers to the correct position.
RegEx (1)
Match: (.*)(-)(.*)(-)(.*)
Replace: \1-\5-\3

The "Break" Option in the Numbering section (10) allows you to reset the numbering when a character changes, for instance in your example the 5th character is the first to change so setting "Break" at 5 resets the numbering at that point.

Re: Can autonumber be made to reset when certain text differs?

PostPosted: Sat Oct 01, 2016 3:07 am
by Admin
Also using Javascript renaming you can do this in one pass and it can get as complex as you need.