@echo off
REM Set needed options
setlocal ENABLEEXTENSIONS
setlocal ENABLEDELAYEDEXPANSION
REM Extract date components from current date
set /a MM=%DATE:~4,2%
set /a DD=%DATE:~7,2%
set /a YYYY=%DATE:~10,4%
set YY=%DATE:~12,4%
REM Get Weeknumber, then output filename
call :WeekNumber %MM% %DD% %YYYY%
for /L %%i in (1,1,3) do (
for /L %%j in (1,1,4) do (
set Filename=AB%YY%%Week%_HOUR%%i_Seg%%j.mp3
echo !Filename!
)
)
goto :EOF
:WeekNumber
REM Calculate an offset based on day of week January 1 fell on
set /a Offset=%3-1900
set /a Offset=((%Offset%+(%Offset%/4))%%7)+6
REM Find out what day of the year (from January 1) we are on
call :DayNumber %1 %2 %3
REM Add offset and then divide by 7 days per week
set /a Week=(%Day%+%Offset%)/7
goto :EOF
:DayNumber
REM Incrementally build up dy number from month and day
set /a Day=0
goto :DayNumber%1
:DayNumber12
set /a Day+=30
:DayNumber11
set /a Day+=31
:DayNumber10
set /a Day+=30
:DayNumber9
set /a Day+=31
:DayNumber8
set /a Day+=31
:DayNumber7
set /a Day+=30
:DayNumber6
set /a Day+=31
:DayNumber5
set /a Day+=30
:DayNumber4
set /a Day+=31
:DayNumber3
set /a Day+=28
REM Add an extra day on leap years
set /a Leap=%3 %% 4
if %Leap% == 0 set /a Day+=1
:DayNumber2
set /a Day+=31
:DayNumber1
set /a Day+=%2
goto :EOF
|