rotatelogs.cmd
@echo off
::Parse the time variable into timeStamp
FOR /F "tokens=1-4 delims=/:., " %%J IN ("%time%") DO SET timeStamp=%%J%%K%%L
::Parse the date variable into dateStamp, YYYYMMDD
FOR /F "tokens=2-4 delims=/:.- " %%J IN ("%date%") DO SET dateStamp=%%L%%K%%J
set datename=%dateStamp%
::Parse the name again and get rid of the spaces
FOR /F "tokens=1-4" %%J IN ("%datename%") DO SET datename=%%J%%K%%L
IF "%datename%"=="" set datename=EMPTY
cd /d x:\logs
FOR %%G IN (*.log) DO ren "%%G" "%datename%_%%G"
choice /t:y,5
cd /d c:\nginx
runas /savecred /env /user:nginxserviceuser "nginx -s reopen"
choice /t:y,5
cd /d x:\logs
move /y %datename%_*.* x:\archives\logdata
---
nginx for Windows http://nginx-win.ecsds.eu/