Filenumber_Groupnumber_filename
I would like to increment filenumber if a duplicate Groupnumber is found. Then restart the increment with other group number.
For example:
If I will save 1_filename it will renamed as 1_1_filename.
If I will save 1_filename it will renamed as 2_1_filename.
If I will save 2_filename it will renamed as 1_2_filename.
If I will save 2_filename it will renamed as 2_2_filename.
....
@echo off
setlocal enabledelayedexpansion
REM this will identify the biggest number
set max=0
for %%x in (*.*) do (
set "FN=%%~nx"
set FN=!FN:~2,1!
if !FN! GTR !max! set max=!FN!
)
rename ....
The code above will only work with only one group per folder. Would it be possible to change the script so that it can identify groupnumber from each other in same folder and then add an increment number differently from each groupnumber.