Compdigitec Labs

« | Home | »

How to force mkdir to create a directory if there isn’t already one

By admin | September 3, 2008

If you’ve ever tried to make a directory if there isn’t one existing, you probably have bumped into the following error:
mkdir: cannot create directory `the_directory': File exists

To fix this, use this instead to suppress error and create parent directories if needed:
mkdir -p your_directory

For more information, see the mkdir page at Wikipedia.

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux | 261 Comments »

261 Responses to “How to force mkdir to create a directory if there isn’t already one”

  1. garage door repair Says:
    October 22nd, 2025 at 21:02

    Amazing a lot of wonderful material.

  2. DOT SAP evaluation Says:
    October 22nd, 2025 at 22:26

    I relish, cause I found exactly what I used to be taking a look
    for. You’ve ended my 4 day long hunt! God Bless you man. Have a great day.
    Bye

  3. electrical companies in Indianapolis Says:
    October 25th, 2025 at 09:38

    I really like reading an article that can make people think.

    Also, thanks for permitting me to comment!

  4. sprinkler company Colorado Springs Says:
    October 25th, 2025 at 09:48

    Excellent blog here! Also your site loads up fast! What host
    are you using? Can I get your affiliate link to your host?
    I wish my web site loaded up as quickly as yours lol

  5. Electrician Salt Lake City Says:
    October 25th, 2025 at 10:59

    Heya i’m for the first time here. I came across this board and I find It truly useful & it helped me out much.

    I hope to give something back and aid others like you helped
    me.

  6. Brittny Says:
    October 25th, 2025 at 13:28

    Thank you for the good writeup. It in fact was a amusement account it.

    Look advanced to more added agreeable from you!
    By the way, how can we communicate?

    Feel free to surf to my page – Brittny

  7. Top Line Constructions Says:
    October 28th, 2025 at 15:31

    Howdy would you mind letting me know which
    webhost you’re using? I’ve loaded your blog in 3 different internet browsers and I must
    say this blog loads a lot quicker then most. Can you recommend
    a good web hosting provider at a reasonable price?
    Thanks, I appreciate it!

  8. Top Line Constructions Says:
    October 28th, 2025 at 15:33

    I think that everything said was very logical. However, what about this?
    suppose you typed a catchier title? I mean, I don’t wish to
    tell you how to run your website, but what if you added a post title that makes people want more?
    I mean How to force mkdir to create a directory if there isn’t already
    one at Compdigitec Labs is a little vanilla. You could peek at Yahoo’s
    home page and see how they write article headlines to grab people
    to open the links. You might add a related video or a related pic or two to
    grab people excited about what you’ve got to
    say. Just my opinion, it would make your blog a little bit more interesting.

  9. High-quality replica designer bags Says:
    October 30th, 2025 at 22:15

    Appreciate the recommendation. Let me try it out.

    Also visit my website High-quality replica designer bags

  10. Sewer Line Repair Arvada Says:
    November 1st, 2025 at 13:34

    I know this web page offers quality dependent articles and additional
    data, is there any other website which presents such things in quality?

  11. Arvada Water Line Replacement Says:
    November 1st, 2025 at 13:46

    Good answers in return of this issue with firm arguments and explaining the whole thing concerning that.

Comments