I‘m using Opus13.
I want to rename multiple files in multiple subfolders within a directory, using the name of each subfolder. The renaming should add a sequential number starting from 1 in order of the original file names, following the name of the subfolder.
Actually, I have a CMD script that meets this requirement, but I can't convert it to a button that can be used directly within opus, can anyone help?
@echo off
setlocal enabledelayedexpansion
for /d %%A in (*) do (
set "folder_name=%%~nxA"
set "index=1"
for %%B in ("%%A\*") do (
set "file_name=%%~nxB"
set "extension=%%~xB"
set "new_name=!folder_name!_!index!!extension!"
ren "%%B" "!new_name!"
set /a index+=1
)
)
echo Renaming of files completed.
exit /b