Create folders in ascending order

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Danny
Posts: 15
Joined: 30 Oct 2013 22:52

Create folders in ascending order

#1 Post by Danny » 24 Nov 2013 06:40

I want to create multiple folders inside a directory (i.e. Folder1, Folder2,...).
The folders will always be in ascending order starting from "000" and go up. (i.e. 000,001,002...)
Each time the script is run it will ask through a prompt stating "How many folders would you like to create">>
Hopefully this can be achived.

AiroNG
Posts: 46
Joined: 17 Nov 2013 15:00
Location: Germany

Re: Create folders in ascending order

#2 Post by AiroNG » 24 Nov 2013 07:13

Something like that?

Code: Select all

@echo off
setlocal EnableDelayedExpansion
set /p count=How many folders?
for /L %%i in (1, 1, %count%) do (
 set "format=000000%%i"
 md folder!format:~-3!
)
goto :eof

Danny
Posts: 15
Joined: 30 Oct 2013 22:52

Re: Create folders in ascending order

#3 Post by Danny » 24 Nov 2013 08:25

Thanks AiroNG for response.
It works

Thanks

Post Reply