Question : How can I create a bat script to find the newest log file in a folder?

Hello,

How can I create a bat script to find the newest log file in a folder?

Also, how can I place the date in a file name with only two digets for the year

Thanks,

Asher.

Answer : How can I create a bat script to find the newest log file in a folder?

Like this (/a:d in a dir command will list only directories):
1:
2:
3:
4:
@echo off
set Folder=C:\Temp
for /f "delims=" %%a in ('dir /o:d /a:d /b "%Folder%\W3SVC*"') do set LatestFolder=%%a
echo The latest W3SVC-subfolder in %Folder% is %LatestFolder%
Open in New Window Select All
Random Solutions  
 
programming4us programming4us