Skip to content

Instantly share code, notes, and snippets.

@theeye-io
Created November 23, 2016 14:01
Show Gist options
  • Save theeye-io/59ef60a8e2f8fcfaf6072490d1695de8 to your computer and use it in GitHub Desktop.
Save theeye-io/59ef60a8e2f8fcfaf6072490d1695de8 to your computer and use it in GitHub Desktop.
rotateLogFile.bat
@echo off
set currentdir=%1
echo %currentdir%
shift
set targetdir=%1
echo %targetdir%
shift
set filename=%1
echo %filename%
shift
set datetime=%date:~-4%_%date:~-7,2%_%date:~-10,2%_%time:~0,2%_%time:~3,2%_%time:~6,2%
cd %currentdir%
echo moving %filename% to %targetdir%\%filename%_%datetime%
move %filename% %targetdir%\%filename%_%datetime%
rem Here is a good place to compress target log file
rem create an empty file
echo. 2>%filename%
echo "success"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment