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 | 401 Comments »

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

  1. slide films Says:
    March 10th, 2026 at 17:44

    Link exchange is nothing else except it is just placing the other person’s web site link on your page at appropriate place and other person will also do same in support of you.

Comments