2

Is there an easy way to create all subdirectories of a path in linux ?

Something like

 mkdir   /a/b/c/d/e/f  

executed in / should create directories a,b,c,d,e,f

2 Answers 2

6

Just use:

mkdir -p /a/b/c/d/e/f

The -p tells mkdir to create parent directories if they dont exist and doesn't give an error if the directory(ies) already exist(s). I wouldn't really consider this to be recursive.

1
  • 1
    No error is given if the directory already exists. If it already exists and is not a directory (regular file, pipe, special, etc.) then you get an error.
    – robert
    Dec 9, 2010 at 23:31
4

Use mkdir -p /a/b/c/d/e/f.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .