Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On ubuntu is there a way to create a directory path in one statement?

Lets say I have the dir /tmp/foo with no subdirectories, and I want to create /tmp/foo/bar/baz.

mkdir /tmp/foo/bar/baz fails with mkdir: cannot create directory /tmp/foo/bar/baz: No such file or directory

Is there a statement that can do this trick?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
mkdir -p /tmp/foo/bar/baz

From 'man mkdir':

-p, --parents
      no error if existing, make parent directories as needed
share|improve this answer
    
Auww, your right. Overlooked that one. –  RickyA Nov 1 '12 at 12:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.