MasterPhW
Master of the Emulation Flame
I'm working on a TV channel for 8 weeks (additional work I have to du for my university... don't ask) and they create for every day a new folder via the context menu in the following format:
"News - 01.8.08 - Fr"
Now I thought, that could be done easier, with a little batch file. But I haven't batch coded for years.
That's what I've done so far:
But I don't have an idea how to let the user add the months and the years and a fixed news before all news and the days beginning from monday!
I would appreciate all help!
"News - 01.8.08 - Fr"
Now I thought, that could be done easier, with a little batch file. But I haven't batch coded for years.
That's what I've done so far:
Code:
@ECHO OFF
CLS
REM ------------------------------------------------------------
REM Name: MON_CREATE.BAT
REM Author: MasterPhW
REM Date: 07. August 2008
REM ------------------------------------------------------------
REM Days of months
REM ------------------------------------
SET /P MAX=How many days has the months?
REM ------------------------------------
:step1
REM get max
REM ------------------------------------
SET lenmax=0
SET dump=%MAX%
:len1
if %dump% NEQ 0 (
SET /a dump=%dump%/10
SET /A lenmax=%lenmax%+1
goto len1
) ELSE (
goto step2
)
REM ------------------------------------
:step2
REM temp var
REM ------------------------------------
SET ZEROS=
SETlocal ENABLEDELAYEDEXPANSION
for /L %%i in (1,1,%lenmax%) do (
SET ZEROS=!ZEROS!0
)
REM ------------------------------------
REM change dir
REM ------------------------------------
pushd %TARGETDIR%
REM ------------------------------------
REM create dir
REM ------------------------------------
SET counter=1
SET /a MAX=%MAX%+1
:step3
if %counter% NEQ %MAX% (
SET lentemp=0
SET dump2=%counter%
:len2
if !dump2! NEQ 0 (
SET /a dump2=!dump2!/10
SET /a lentemp=!lentemp!+1
goto len2
)
SET /a nozeros=%lenmax%-!lentemp!
mkdir !ZEROS:~0,%nozeros%!%counter%
SET /a counter=!counter!+1
goto step3
)
REM ------------------------------------
REM done
REM ------------------------------------
ECHO.
ECHO Months done!
PAUSE
REM -------------------------- E O F ---------------------------
I would appreciate all help!