I have a windows batch file that runs daily. Wish to log data into a file and want to rotate it (i.e. having at most the last 7 days worth of data).
Looked into the
If you can change format of short date in the PC to "ffffd yyyy-MM-dd" (only first parameter 'ffffd' is compulsory), then following command returns-
c:\>vol | date
The current date is: Mon 2014-12-01
Then you can write you batch file -
@echo off
vol | date | find /i "sun" > nul
if not errorlevel 1 goto SUN
vol | date | find /i "mon" > nul
if not errorlevel 1 goto MON
# write block for other week days
goto END
:SUN
set fname="sun"
goto BACKUP
:MON
set fname="mon"
goto BACKUP
# write block for other week days
:BACKUP
echo %fname%
:END