Batch file that will create skeleton directories of ZF2

After a long time write a batch file to create a skeleton directory for Zend Framework 2 module. Hope it may help someone who work in windows 7 OS

@echo off
@setlocal ENABLEDELAYEDEXPANSION
@rem this file will create required empty directory of a ZF2 module
@rem author Shahadat Hossain Khan (shahadathossain.com)
ECHO.
IF "%~1"=="" GOTO noModuleName
SET modName=%~1
CALL :UCase %modName% _UCMN
CALL :LCase %modName% _LCMN
IF NOT EXIST "%_UCMN%" (
 MKDIR %_UCMN%
 MKDIR %_UCMN%\config
 MKDIR %_UCMN%\src
 MKDIR %_UCMN%\src\%_UCMN%
 MKDIR %_UCMN%\src\%_UCMN%\Controller
 MKDIR %_UCMN%\src\%_UCMN%\Form
 MKDIR %_UCMN%\src\%_UCMN%\Model
 MKDIR %_UCMN%\view\
 MKDIR %_UCMN%\view\%_LCMN%
 MKDIR %_UCMN%\view\%_LCMN%\%_LCMN%
 ECHO Directory created. Named - %modName%
) else (
 ECHO Directory already exist!
) 
GOTO:EOF
:noModuleName
ECHO You must provide module name along with this command as 1st argument
GOTO:EOF


:LCase
:UCase
:: Syntax: CALL :UCase _VAR1 _VAR2
:: Syntax: CALL :LCase _VAR1 _VAR2
:: _VAR1 = Variable NAME whose VALUE is to be converted to upper/lower case
:: _VAR2 = NAME of variable to hold the converted value
:: Note: Use variable NAMES in the CALL, not values (pass "by reference")
set varX=%1
set frstChar=%varX:~0,1%
set rstChar=%varX:~1%
FOR %%Z IN (Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx 
Yy Zz) DO (
 SET pX=%%Z
 set c1=!pX:~0,1!
 set c2=!pX:~1,1!
 IF /I "%0"==":UCase" (
 if %frstChar%==!c1! SET _Abet=!c1!
 if %frstChar%==!c2! SET _Abet=!c1!
 )
 IF /I "%0"==":LCase" (
 if %frstChar%==!c1! SET _Abet=!c2!
 if %frstChar%==!c2! SET _Abet=!c2!
 )
)
SET _Word_Rtrn=%_Abet%%rstChar%
SET %2=%_Word_Rtrn%
GOTO:EOF


endlocal

Usage

<your batch file name> <the module name>

Posted in php, webdevelopment, windowsTagged , , , , , , ,