Create 366-day month, day, comments subfolder set

Oct 18, 2009
358
17
This program creates a set of 12 monthly folders, day folders in those, "comments" folders in those. It must be run from TCC, not Explorer.

:: Make_Cal-comments_Folders.btm :: :: This requires the free TCCLE or TCC-RT or paid TCC from JPSoft :: :: *** WARNING !!! *** THIS *MUST* BE RUN ONLY FROM A COMMAND PROMPT !!! :: :: If you run it from File Explorer it sticks everything in C:\Windows\System32 :: :: Make_Calendar MM - Mon Year format: 01 - Jan 2015 :: :: by Joseph "Rick" Reinckens :: No copyright claimed :: :: IN THE CURRENT FOLDER Creates 12 month subdirectories and 366 day :: subdirectories AND creates a Comments subfolder for each day :: :: The name of the "Comments" subfolders can be changed by changing :: the Sub_Name variable. :: :: :: FORMAT: :: 01 - Jan 2015 :: 02 - Feb 2015 :: Under the 02 - Feb 2015 folder these folders are created: :: 01 :: 02 :: :: Under THOSE folders a Comments folder is created, i.e. :: F:\MY_FILES\04 - Apr 2016\15\Comments :: :: If you include a parameter, that will be used instead of the year, e.g. :: MAKE_CALENDAR FIRST_YEAR :: Creates subdirs named: :: 01 - Jan FIRST_YEAR :: 02 - Feb FIRST_YEAR :: :: To remove a subdirectory tree from DOS use DELTREE dir_name @echo off :: Defaults to CURRENT year SET YR=%1 IF "%YR%"=="" SET YR=%_year :: Name of the subfolder that will go in each date Set Sub_Name=Comments Echo. :: JANUARY SET MO=01 - Jan Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,31) GOSUB Make_Folders :: FEBRUARY SET MO=02 - Feb Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,29) GOSUB Make_Folders :: MARCH SET MO=03 - Mar Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,31) GOSUB Make_Folders :: APRIL SET MO=04 - Apr Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,30) GOSUB Make_Folders :: MAY SET MO=05 - May Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,31) GOSUB Make_Folders :: JUNE SET MO=06 - Jun Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,30) GOSUB Make_Folders :: JULY SET MO=07 - Jul Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,31) GOSUB Make_Folders :: AUGUST SET MO=08 - Aug Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,31) GOSUB Make_Folders :: SEPTEMBER SET MO=09 - Sep Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,30) GOSUB Make_Folders :: OCTOBER SET MO=10 - Oct Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,31) GOSUB Make_Folders :: NOVEMBER SET MO=11 - Nov Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,30) GOSUB Make_Folders :: DECEMBER SET MO=12 - Dec Echo %MO MKDIR "%MO% %YR%" FOR %%Day_Num in (01,02,03,04,05,06,07,08,09) GOSUB Make_Folders FOR /L %Day_Num in (10,1,31) GOSUB Make_Folders Echo. Echo. Dir pause Quit :Make_Folders MKDIR "%MO %YR\%Day_Num" MKDIR "%MO %YR\%Day_Num\%Sub_Name" RETURN
 

samintz

Scott Mintz
May 20, 2008
1,462
14
Solon, OH, USA
That is way more verbose than it needs to be. I hard coded '2019' and 'Comments' in this example, but you should be able to adapt it as needed.
Code:
setlocal 
function monthf=`%@word[%1,. Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec]`
function mdays=`%@word[%1,. 31 28 31 30 31 30 31 31 30 31 30 31]`
do m=1 to 12
  do d=1 to %@mdays[%m]
    md /s %@formatn[02.0,%m] - %@monthf[%m] 2019\%@formatn[02.0,%d]\Comments
  enddo
enddo
endlocal