Skip to content

Instantly share code, notes, and snippets.

@burgiuk
Created March 15, 2017 16:05
Show Gist options
  • Save burgiuk/4a17650d3b59f56a389d8302538249e5 to your computer and use it in GitHub Desktop.
Save burgiuk/4a17650d3b59f56a389d8302538249e5 to your computer and use it in GitHub Desktop.
Batch script to rotate PHP logs
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SET logPath=c:\php\logs\
SET currentLog=PHP54_errors.log
FOR /F %%A IN ('WMIC OS GET LocalDateTime ^| FINDSTR \.') DO @SET B=%%A
MOVE %logPath%%currentLog% %logPath%%B:~0,4%-%B:~4,2%-%B:~6,2%.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment