File numbering format

Post any Bulk Rename Utility support requirements here. Open to all registered users.

File numbering format

Postby DavidS » Tue Jun 08, 2021 5:35 am

I want to be able to choose a numbering format which includes a separator for the thousands; for example 3,436 or 3'456. I know I could add a number at the front then run BRU again to insert the separator, but that's a kludge for an otherwise gorgeous app.
DavidS
 
Posts: 1
Joined: Tue Jun 08, 2021 5:25 am

Re: File numbering format

Postby therube » Tue Jun 08, 2021 4:19 pm

For something like that, if there existed the ability to rearrange the ordering in which the different tasks were performed...

As it is, 7:Add is done before 10:Numbering.
But if you had the option to rearrange, such that 10:Numbering was done first, then 7:Add was done after that, you could then do something like:

10:Numbering, Mode: Prefix, Start: 1000
7:Add, Insert: ', at: 2
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: File numbering format

Postby Admin » Wed Jun 09, 2021 12:57 am

Hi,

this javascript function adds a counter customly formatted with a . and , and can be used in BRU renaming:

Code: Select all
Number.prototype.format = function(n, x, s, c) {
    var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\D' : '$') + ')',
        num = this.toFixed(Math.max(0, ~~n));

    return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || ','));
};

newName = (counter).format(0, 3, ',', '.') + "-" + name;
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: File numbering format

Postby Luuk » Wed Jun 09, 2021 10:15 am

Yes, this very easy with brc64.exe, because you can specify to conduct auto-numbering before regex, so then regex can modify the auto-numbers.
But without the javascript, you are already doing it the best way, so then just having to fix the auto-numbers with another run.
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm


Return to BRU Support


cron