batch script to remove brackets and spaces from media files D:\rename

cd D:\rename
setlocal enabledelayedexpansion
for %%a in (*.mp4) do (
set f=%%a
set f=!f:^(=!
set f=!f:^)=!
ren "%%a" "!f!"
)
for %%a in (*.gif) do (
set f=%%a
set f=!f:^(=!
set f=!f:^)=!
ren "%%a" "!f!"
)
for %%a in (*.jpg) do (
set f=%%a
set f=!f:^(=!
set f=!f:^)=!

ren "%%a" "!f!"
)
for %%a in (*.png) do (
set f=%%a
set f=!f:^(=!
set f=!f:^)=!
ren "%%a" "!f!"
)
for %%f in (*.*) do (
set ARG=%%~nxf
rename "%%f" !ARG: =!
)

Leave a Reply

Your email address will not be published. Required fields are marked *