i am trying to remove prefix from all files in current folder and subfolders i tryed following code which work only for current folder
setlocal enabledelayedexpansion
for %%F in (*) do (
set "FN=%%F"
set "FN=!FN:~15!"
ren "%%F" "!FN!"
)
goto :eof
Please Help me to solve this
for /f "delims=" %%a in ('dir /b /a-d /s') do (
set "fname=%%~nxa"
set "fpath=%%~dpa"
setlocal enabledelayedexpansion
set "nname=!fname:~15!"
ren "!fpath!!fname!" "!nname!"
endlocal
)
This is the safe way to preserve exclamation marks.