Answer the question
In order to leave comments, you need to log in
How to simultaneously rename numbered files to "number++"?
Good day.
OS: Windows 10.
There are n-th number of files (let's say json), whose names consist of digits-numbers. Let's say I want to insert another file somewhere, for example between 13.json and 14.json. In this case, the new file will be 14.json, and the old 14th and all subsequent files after it should be renamed to the old number + 1. "Bulk Rename Utility" to implement it?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
setlocal enabledelayedexpansion
set /a first_index = 14
set /a last_index = first_index
:LOOP
if exist %last_index%.json (
set /a last_index += 1
goto LOOP
)
set /a last_index -= 1
for /l %%i in (!last_index!, -1, %first_index%) do (
set /a j = %%i + 1
ren %%i.json !j!.json
)
endlocal
You can use "Advanced Rename" in Powertoys or through powershell (I won't tell you a specific script - you need to parse file names)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question