Easily Create Nested Directories Using MkDir

Creating nested directories using Windows Explorer can be quite tedious. First you have to create the master folder, open it and then create the sub-folder, open it then create another sub-folder… you get the idea. As a quicker alternative, you can use the “MkDir” command line tool to easily create the entire folder structure with a single command.

For example, the command:

MkDir “C:\test1\test2\test3″

Would create “C:\test1″ if it did not exist and then create “C:\test1\test2″ if it did not exist and finally create “C:\test1\test2\test3″ if it did not exist.

This command can definitely come in handy in the event you have to create folder structures quickly. Combine this with the use of the up arrow/OS keys functionality in the command prompt to cycle through the previous commands and you can really save yourself some time.

Free eBook!

Like what you read?

If so, please join over 28,000 people who receive our exclusive weekly newsletter and computer tips, and get FREE COPIES of 5 eBooks we created, as our gift to you for subscribing. Just enter your name and email below:

Post A Comment Using Facebook

Discuss This Article (Without Facebook)

2 comments

  1. Charley_EntrepreNerd /

    On my USB i carry a batch file for just this task, named techfolders.bat:

    cd /d C: && mkdir Tech && cd Tech && mkdir Apps “Backups/ccleaner backups” Drivers && exit

    Copy and paste into notepad and “save as” (ensure all files selected) with the format of: name.bat

    The && conjoins multiple commands together; and this can also be run from a Start -> Run box [keyboard shortcut Windows key + R] with the addtion of cmd /c prior to the string, “cmd” launches the CLI (Command Line Interface) “DOS BOX” and /c switch ensures the CLI Box closes gracefully when command completed.

    and here is my current favorite CMD string to enter at the run box, parses the information without the IP6 and toredo info:
    cmd /k ipconfig /all | find “Default Gateway”

  2. Nice tip. You can do the same thing in a linux environment, you just need the “-p” option.

    “mkdir -p test1/test2/test3″ would create the three subdirs directly under your current dir.

Leave a Reply

PCMech Insider Cover Images - Subscribe To Get Your Copies!
Learn More
Every week, hundreds of tech enthusiasts, computer owners
and geeks read The Insider, the digital magazine of PCMech.

What’s Your Preference?

Daily Alerts

Each day we send out a quick email to thousands of PCMECH readers to notify them of new posts. This email is just a short, plain email with titles and links to our latest posts. You can unsubscribe from this service at any time.

You can subscribe to it by leaving your email address in the following field and confirming your subscription when you get an email asking you to do so.

Enter your email address for
Daily Updates:

Weekly Newsletter

Running for over 6 years, the PCMECH weekly newsletter helps you keep tabs on the world of tech. Each issue includes news bits, an article, an exclusive rant as well as a download of the week. This newsletter is subscribed to by over 28,000 readers (many who also subscribe to the other option) - come join the community!

To subscribe to this weekly newsletter simply add your email address to the following field and then follow the confirmation prompts. You will be able to unsubscribe at any time.

Enter your email address for
Free Weekly Newsletter: