Question : Quick Batch File Rename Question

I need to rename this

1234567890123456.com-combined.log.10.19.2006

to this

ex10.19.2006.log

Via a batch file.  I am going to have a log file per day dumped into the directory, so really I just need to trim down to that date and throw ex in front and .log at the end.  The files will always be the same length.

Of course the url has been masked.  It will not be numbers.

Thanks!

Answer : Quick Batch File Rename Question

Sure, no problem:

@echo off

setlocal

set fileMask=1234567890123456.com-combined.log.*

for /f "delims=" %%a in ('dir /b "%fileMask%"') do call :PROCESS "%%a"

goto :EOF

:PROCESS

set fileName=%~1
set newFileName=ex%fileName:~-10%.log

echo ren "%fileName%" "%newFileName%"
Random Solutions  
 
programming4us programming4us