Create new directories and subdirectories in Unix using a single terminal command

It’s funny how programmers get in a "rut", using the same old coding habits and command line syntax for years on end.  I just found that you can create new directories and subdirectories with a single Unix mkdir command using the -p parm.

mkdir -p top_level_directory/child_directory/another_child_directory

And if you’re curious, this won’t work (I tried it):

mkdir -p onemoredir/../anotherdir

Goes to show you that we should follow the same advice we give the junior developers – "check the man page".

Leave a Reply

Related Post

A homeless man and his dog

A homeless man and his dog

I ran across this powerful picture which lead me to a bit of research on the homeless problem. Although difficult to measure, it is estimated that between 2.3 and 3.5 million people will experience homelessness.

Windows 8 first time install – thoughts

I downloaded and installed the Windows 8 Consumer Preview on a VMWare virtual machine. I had a Windows 8 Technical Preview installed on the VM and the Windows 8 Consumer Preview happily installed on top of it. Installation went quite well although it took a couple of hours to complete (on a quad-core processor). Here’s a few screenshots taken during my walkthrough of the Windows 8 desktop system.

Pocket Legends Archer Build Guide

I found this great game that’s similar to World of Warcraft, is cheap, and playable on my Android mobile device and my PC (plays in the Google Chrome browser). The graphics are great and comparable to World of Warcraft graphics except the world is somewhat limited (imagine World of Warcraft dungeons with walls limiting the area you can travel in). The performance on my Droid Bionic and in the Google Chrome browser is very impressive too.