::Set vars
SET LOGFILE=\\
SET LOGNAME=log
:CHECK_FILE
:: Create file if does not exist
IF EXIST %LOGFILE% (goto:CHECK_SIZE) ELSE (
echo Created %DATE% > %LOGFILE%
goto:CHECK_FILE
)
:CHECK_SIZE
FOR %%? IN (%LOGFILE%) DO (SET FILESIZE=%%~z?)
::Check if less than 10kb
If %FILESIZE% LSS 10000 (
GOTO:EOF
)
::Check if greater than 10kb, if so rename to unique name
If %FILESIZE% GTR 10000 (
ren %LOGFILE% "%LOGNAME%-%date:~4,2%-%date:~7,2%-%date:~10%-%time:~0,2%%time:~3,2%%time:~6,2%"
pause
echo Created %DATE% > %LOGFILE%
)
GOTO:EOF
No comments:
Post a Comment