How to write a dos batch script to create a folder structure?

15,439

Erm...is this a trick question, it looks kinda straightforward? if not then perhaps try the following in a batchfile somewhere in your path;

md _Documentation
md _ProjectManagement
md Releases
md Source
md Source\Trunk
md Source\Trunk\Library
md Source\Trunk\Projects
md Source\Trunk\Tests

Best of luck.

Share:
15,439

Related videos on Youtube

David Negron
Author by

David Negron

I am a Sr. Software Engineer for a marketing agency in Lake Mary, Florida.

Updated on September 17, 2022

Comments

  • David Negron
    David Negron over 1 year

    I would like to be able to have a dos batch script that I could utilize to create a specific folder structure below what ever directory I may be in at any given time.

    The specific folder structure that I need is:

    [Directory:\] _Documentation

    [Directory:\] _ProjectManagement

    [Directory:\] Releases

    [Directory:\] Source

    [Directory:\] Source -> Trunk

    [Directory:\] Source -> Trunk -> Library

    [Directory:\] Source -> Trunk -> Projects

    [Directory:\] Source -> Trunk -> Tests

  • Simon Johnson
    Simon Johnson almost 15 years
    Don't you mean MkDir? :)
  • David Negron
    David Negron almost 15 years
    Yeah I was afraid that the answer would be simple. I don’t usually work at the command line level now a days so I wasn’t sure if there were any new strategies for accomplishing this task. I guess being a coder puts me in the frame of mind that it would have been a bit more complicated. I thought that I would have needed some variable to give me a reference to the local directory in order to know where to create the folders. Yet another case of over engineering. Thanks.
  • Chopper3
    Chopper3 almost 15 years
    @Simon Johnson - either works actually, mine's more 'old school' :)
  • Joey
    Joey about 14 years
    On Windows you can usually (because command extensions are enabled by default) leave out creating the Source and Source\Trunk directories since intermediate directories are automatically created. Ah well, it can't be DOS anyway ... I hate when people msitag their questions -.-