Request: Batch Rename: option to renumber using 1st number in file names, not last number

Ideas for improvements and requests for new features in XnView Classic

Moderators: XnTriq, helmut, xnview

Shokakusan
Posts: 10
Joined: Sat Jan 23, 2016 3:02 am

Request: Batch Rename: option to renumber using 1st number in file names, not last number

Post by Shokakusan »

On the Batch Rename window, offer a saved option to build the Name template so that the 1st number in the file names is replaced by #'s instead of the last number in the file names.

As an example, I use file names that contain:
1. a person's name
2. a sequence number of the picture
3. the title of the appearance
4. the date (typically the year of the appearance)

So if I were collecting pictures for a Michael Jackson retrospective, the file names might be:
Michael Jackson-080_Remember the Time 1992
Michael Jackson-081_Remember the Time 1992
Michael Jackson-082_Remember the Time 1992
Michael Jackson-083_Remember the Time 1992
Michael Jackson-084_Remember the Time 1992
Michael Jackson-090_Top of the Pops 1992 TV
Michael Jackson-091_Top of the Pops 1992 TV
Michael Jackson-092_Top of the Pops 1992 TV
Michael Jackson-093_Top of the Pops 1992 TV
Michael Jackson-094_Top of the Pops 1992 TV
Michael Jackson-100_Jam 1992
Michael Jackson-101_Jam 1992
Michael Jackson-102_Jam 1992

In the same folder, I might want to add retrospectives of other singers using the same approach:
The Beatles-010_Penny Lane 1967
The Beatles-011_Penny Lane 1967
The Beatles-012_Penny Lane 1967
The Beatles-020_All You Need Is Love 1967
The Beatles-021_All You Need Is Love 1967
The Beatles-030_Hello, Goodbye 1967
The Beatles-040_Magical Mystery Tour 1967 TV
The Beatles-041_Magical Mystery Tour 1967 TV
The Beatles-042_Magical Mystery Tour 1967 TV
The Beatles-043_Magical Mystery Tour 1967 TV
The Beatles-050_Strawberry Fields Forever 1967
The Beatles-051_Strawberry Fields Forever 1967
The Beatles-052_Strawberry Fields Forever 1967

Putting the sequence number at the end of the file name will re-sort the the pictures by title instead of chronological order. Putting the "1992" and "1992 TV" in front of the title will re-sort all TV appearances in a particular year after all video appearances in that year (not chronological order) as well as sort the titles by alphabetical order instead of chronological order.

Today, I have to edit the Name templates for each group of file names for a title to move the #'s to the sequence number.

Update 28-Apr-2023:
In the 1st example above, when I select and rename:
Michael Jackson-100_Jam 1992
Michael Jackson-101_Jam 1992
Michael Jackson-102_Jam 1992
Xnview creates the Batch Rename window with:
Name template: Michael Jackson-100_Jam ####
Start: 1992
etc.
I would like an option to generate the Name template using the 1st numeric digits encountered instead of the last digits such as:
Name template: Michael Jackson-###_Jam 1992
Start: 100
etc.
Last edited by Shokakusan on Fri Apr 28, 2023 3:32 pm, edited 2 times in total.
User avatar
michel038
XnThusiast
Posts: 1402
Joined: Tue Sep 27, 2016 8:18 am
Location: France

Re: Request: Batch Rename: option to renumber using 1st number in file names, not last number

Post by michel038 »

You mean by using {Filename Number} ?
- I tried to rename DSCN0025 year2015.jpg with this template :
{Filename Number}-{Filename}
- I Got
2015-DSCN0025 year2015.jpg
-You wanted to get
0025-DSCN0025 year2015
isn'it ?

So you would like to be able to choose something like this : {Left Filename Number} or {Right Filename Number} ?

Maybe Pierre will add this feature ?


With Ant Renamer, you can use a regexp like this
replace (.*)-([0-9]{3})(.*) by $2 $1 $3 (or $1$2$3 without spaces)
where
(.*)- means that $1 is the string followed by a -
([0-9]{3}) means $2 is a 3 digits string
(.*) means $3 is any string that follows the previous one

XnViewMP can use regexp in batch rename, but unfortunately $1 $2 $3 variables are not handled ...

Otherwise, the treatment requires 3 passes.
- Replace 1967 by xxx
- Use {filename number}
- Replace xxx by 1967
Shokakusan
Posts: 10
Joined: Sat Jan 23, 2016 3:02 am

Re: Request: Batch Rename: option to renumber using 1st number in file names, not last number

Post by Shokakusan »

What I would really like is an option that changes how Xnview generates the Name template when I select and rename multiple files:

If I select and rename:
- Michael Jackson-100_Jam 1992
- Michael Jackson-101_Jam 1992
- Michael Jackson-102_Jam 1992

Xnview presents the Batch Rename window with:
. Name template: Michael Jackson-100_Jam ####
. Start: 1992
. Step: 1

I would like an option to generate the Name template using the 1st digits instead of the last digits such as:
. Name template: Michael Jackson-###_Jam 1992
. Start: 100
. Step: 1

P.S. If Xnview were really smart, it would analyze the 1st and 2nd filenames and not only detect that "blocks" of numeric digits occurred in the file name in two places (e.g., 100 and 1992), but which set of digits changes between the 1st and 2nd filenames (100 : 101 vs 1992 : 1992) and generate the Name template with ### in place of 100 (which is different from 101) instead of 1992 (which doesn't change). However, an option to generate the name template using the 1st set of digits or the last set of digits is sufficient for me.