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

The Secret in the Bible book puzzle solution

The Secret in the Bible by Tony Bushby has quite a few factual errors and is more of an atheist “push my agenda” type of book rather than a historical review of the subject matter. There was one interesting aspect to the book though. It included a “puzzle” whereby each of the sixteen chapters contained a secret word that when put together in a sentence reveals ancient knowledge so secret, Bushby was not allowed to outright reveal them in his book for fear of some sort of extremely viscous retribution from someone (boy, have I got news for him).

Google engineer mistakenly posts internal memo to public forum

Making the equivalent of mistakenly hitting the reply all button, Google Engineer Steve Yegge posted a very well written rant on the importance of architectural planning and the importance of building products around a platform. The neat thing about his post is that he is almost “spot on” with his logic. Long post but well worth reading.

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.