Thanks to this post: Remove Last Characters from my filenames in windows
I have been able to partially achieve my goal of removing the last two digits of the filenames in a directory, but I need to apply it to only .log files as other files live in that folder.
I have tried adding the .log part in a number of places, but it hasn't worked.
This script works in as much as it removes the last two characters from the filename correctly, but I need it to only perform it on .log extensions
Any help would be appreciated.
@echo off
setlocal enabledelayedexpansion
set FOLDER_PATH=C:\inetput\wwwroot\logs\
for %%f in (%FOLDER_PATH%*) do if %%f neq %~nx0 (
set "filename=%%~nf"
ren "%%f" "!filename:~0,-2!00%%~xf"
)
PAUSE