jump to navigation

Rename multiple files using Command Prompt April 25, 2023

Posted by haryoktav in Interest.
comments closed

When you deal with dataset, sometime, the file name gets very long, and somehow produces error because of.. its very long name, of course! So, this is the code to rename multiple files by adding index number.

Save this code as BAT-file then run this code in the same folder.

set /a Index=1

setlocal enabledelayedexpansion

for /r %%i in (makan.*.json) do ( 
    rename "%%i" "makan.!Index!.json"
    set /a Index+=1
)

Then.. what a wonderful world!

New name