how can i rename multiple files at once code example
Example 1: cmd rename multiple files
for /d %F in ("G:\Deletable\*") do rename "%F" "%~nF_zzz%~xF"
Example 2: batch rename files
REM
REM
REM
REM
REM
@echo off
setlocal EnableDelayedExpansion
set "pattern_to_replace=("
set "replace_text=_"
for %%N in ("*") do (
set "InitName=%%N"
call set NewName=%%InitName:!pattern_to_replace!=!replace_text!%%
if NOT !InitName!==!NewName! (
echo rename "!InitName!" "!NewName!"
rename "!InitName!" "!NewName!"
)
)
@echo on
REM
REM
REM
@echo off
setlocal EnableDelayedExpansion
set "pattern_to_replace= "
set "replace_text=_"
for /R "%cd%" %%N in ("*") do (
set "InitName=%%~nN%%~xN"
call set NewName=%%InitName:!pattern_to_replace!=!replace_text!%%
if NOT %%N==%%~dN%%~pN!NewName! (
echo rename "%%~dN%%~pN!InitName!" "!NewName!"
rename "%%~dN%%~pN!InitName!" "!NewName!"
)
)
@echo on
REM