@echo off
set count=1
set basedir=C:\old_data\report
for /f "tokens=*" %%G in ('dir /a-d /b %basedir%') do (call :subroutine %%G)
goto :eof
:subroutine
for /F "delims=_" %%a in ("%1") do (
ren "%basedir%\%1" "%%a_SPRW_Light_%count%.txt"
)
set /a count+=1
goto :eof
Example:
"20141013_Test_Rept.dat" will be renamed to "20141013_SPRW_Light_1.txt"
set count=1
set basedir=C:\old_data\report
for /f "tokens=*" %%G in ('dir /a-d /b %basedir%') do (call :subroutine %%G)
goto :eof
:subroutine
for /F "delims=_" %%a in ("%1") do (
ren "%basedir%\%1" "%%a_SPRW_Light_%count%.txt"
)
set /a count+=1
goto :eof
Example:
"20141013_Test_Rept.dat" will be renamed to "20141013_SPRW_Light_1.txt"
No comments :
Post a Comment