@ECHO OFF
PUSHD log
FOR /F usebackq %%I IN (`DIR /B^|findstr /R /C:"\.[0-9][0-9]*$"`) DO CALL :1 %%I
REM DEL *.lck
POPD
GOTO :EOF

:1
IF NOT EXIST %1 EXIT /B
IF "%~z1" == "0"  (DEL %1&EXIT /B)
SET T=%~t1
SET T=%T:/=%
SET T=%T::=%
SET T=%T: =-%
SET T=%T:~2%
SET T=%T%_%~1

:2
ECHO %T%|findstr /R /C:"\.[0-9]*$">NUL||GOTO :3
SET T=%T:~,-1%
GOTO :2
:3

ECHO RENAME "%~1" "%T%"
     RENAME "%~1" "%T%"
EXIT /B
