PPRuNe Forums - View Single Post - Need help creating a file system
View Single Post
Old 7th Mar 2010, 16:15
  #12 (permalink)  
Mac the Knife

Plastic PPRuNer
 
Join Date: Sep 2000
Location: Cape Town
Posts: 1,898
Received 0 Likes on 0 Posts
Here's a nicer version where you can choose how many directories to create
Note that I haven't implemented proper error trapping in the input yet

--------------------------------------------------
@echo off
cls
goto start

rem makedirs.cmd
rem Version 0.01.06
rem Creates multiple sequentially numbered subdirectories
rem Copyright ajbc - ajbc{#at#}iafrica.com
rem This utility starts from the directory that it finds itself in so
rem put it in the directory where you want to create the new subdirectories

:start
set /P numdirs=How many directories do you want to create?
rem get user input on number of directories to create
echo.
echo Please wait a moment while the directories are created
set /A counter=0
set filename=0
rem counter is numeric (forced by /A) and filename is a string (default)

:loop
set /A counter=%counter%+1
if %counter% LEQ 9999 set filename=%counter%
if %counter% LEQ 999 set filename=0%counter%
if %counter% LEQ 99 set filename=00%counter%
if %counter% LEQ 9 set filename=000%counter%
md %filename%
rem check if the counter has reached numdirs
if %counter% EQU %numdirs% goto end
rem exit when numdirs is reached
goto loop

:end
rem end batch and exit

-------------------------------------------------

Jeez I'm a sad bastard...............

Mac :-)
Mac the Knife is offline