{"id":6026,"date":"2024-12-18T10:23:43","date_gmt":"2024-12-18T10:23:43","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=6026"},"modified":"2026-02-02T07:21:05","modified_gmt":"2026-02-02T07:21:05","slug":"how-to-create-directory-with-missing-parent-directory","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/","title":{"rendered":"How to Create Directory with Missing Parent Directory"},"content":{"rendered":"\n<p>Software developers and system administrators need to routinely create directories to store files, data and sub directories. But not every directory has a parent directory. Sometimes you may need to create directory, whose parent (or ancestor) directories do not exist. There are several ways to create directory with missing parent directory. You can create such directory using programming languages such as Python, or using operating system commands in Windows, Linux &amp; MacOS. In this article, we will learn how to create directory with missing parent directory, using either of these methods.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#The_Problem\" >The Problem<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#How_to_Create_Directory_with_Missing_Parent_Directory\" >How to Create Directory with Missing Parent Directory<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#1_Using_Python\" >1. Using Python<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#Python_35\" >Python 3.5+<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#Python_32\" >Python 3.2+<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#Python_27\" >Python 2.7+<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#2_Using_LinuxUnixMacOS\" >2. Using Linux\/Unix\/MacOS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#3_Using_PowerShell\" >3. Using PowerShell<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#4_Using_Windows_Command_Prompt\" >4. Using Windows Command Prompt<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#FAQ\" >FAQ<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_Problem\"><\/span>The Problem<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Generally, we create a new directory, say, <em>\/home\/ubuntu\/data<\/em> in a another directory <em>\/home\/ubuntu<\/em> using OS commands or programming languages. Since <em>\/home\/ubuntu<\/em> already exists, the new directory is easily created without any errors. But what if you want to create a directory <em>\/home\/ubuntu\/data\/project\/test<\/em>. Here the parent directories <em>\/home\/ubuntu\/data<\/em> and <em>\/home\/ubuntu\/data\/project<\/em> do not exist. So you will most likely get an error. In such cases, we need a solution that first creates these parent directories and lastly creates the innermost directory <em>\/home\/ubuntu\/data\/project\/test<\/em>. This is the problem we are trying to solve.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Create_Directory_with_Missing_Parent_Directory\"><\/span>How to Create Directory with Missing Parent Directory<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Depending on your requirements, there are several simple ways to easily create a directory with missing parent directory. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Using_Python\"><\/span>1. Using Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>You can use programming languages like Python to create directories from within your script or application. It provides many useful libraries and functions for this purpose.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Python_35\"><\/span>Python 3.5+<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>If you are using Python &gt;=3.5, then using pathlib library will be very helpful. It provides a function mkdir() that recursively creates new directory and its parents. It does not throw an error if the directory or any of its parents already exist. It supports many options. Among them, the option parents=True ensures that the parent directories are also created, if not present already. The option exist_ok=True will not throw an error if the directory exists. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pathlib.Path('\/path\/to\/directory').mkdir(parents=True, exist_ok=True) <\/pre>\n\n\n\n<p>Here is the code to create \/home\/ubuntu\/data\/project\/test.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import pathlib<br>pathlib.Path('\/home\/ubuntu\/data\/project\/test').mkdir(parents=True, exist_ok=True) <br><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Python_32\"><\/span>Python 3.2+<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Python 3.4 comes with pathlib but it does not support exist_ok option, that disables error message in case the directory to be created already exists. Also, Python &lt;3.4 does not support pathlib library. So, it is advisable to install a backport <a href=\"https:\/\/pypi.python.org\/pypi\/pathlib2\/\" target=\"_blank\" rel=\"noreferrer noopener\">pathlib2<\/a> that not only supports mkdir() function but also exist_ok option. You can install it using the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip install pathlib2<br>OR<br>pip3 install pathlib2<\/pre>\n\n\n\n<p>Once it is installed, you can use mkdir() as shown in the previous section.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import pathlib2<br>pathlib2.Path('\/home\/ubuntu\/data\/project\/test').mkdir(parents=True, exist_ok=True)<\/pre>\n\n\n\n<p>Alternatively, you can also use os module that provides many functions to easily interact with file system. It provides makedirs() function to create directory along with its parent directories. Here is the command to create new directory.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">os.makedirs(\/path\/to\/directory, exist_ok=True)<\/pre>\n\n\n\n<p>Here is the command to create directory \/home\/ubuntu\/data\/project\/test along with its missing parent directories.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import os<br>os.makedirs('\/home\/ubuntu\/data\/project\/test', exist_ok=True)<\/pre>\n\n\n\n<p>Please note, only Python 3.2+ supports option exist_ok, with default value of False. Older Python versions do not support this option.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Python_27\"><\/span>Python 2.7+<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In Python 2.7+ also, you need to install pathlib2, which is a backport to pathlib, available in Python 3.5+. Thereafter, you can use mkdir() function in it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import pathlib2<br>pathlib2.Path('\/home\/ubuntu\/data\/project\/test').mkdir(parents=True, exist_ok=True)<\/pre>\n\n\n\n<p>The makedirs() function in os module does not support exist_ok option and will throw an error if your new directory already exists. Therefore, we need to use it along with os.path.isdir() function, which basically checks if the directory exists or not. Here is the code for this purpose.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import os<br>try: <br>    os.makedirs('\/path\/to\/dir')<br>except OSError:<br>    if not os.path.isdir('path\/to\/dir'):<br>        raise<\/pre>\n\n\n\n<p>In the above code, we first call makedirs() function to create the directory. If it throws an error, we check if the directory exists using os.path.isdir() function. Typically, people use the following code for this purpose.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import os<br>if not os.path.isdir('\/path\/to\/dir'):<br>    os.makedirs('\/path\/to\/dir')<\/pre>\n\n\n\n<p>The above code may create a race condition where the directory is created between the execution of os.path.isdir() and os,makedirs() functions. This happens in case of concurrent operations. It is to avoid such problems that we use the try&#8230;except method mentioned above.<\/p>\n\n\n\n<p>Please note, you can also use os.path.exists() instead of os.path.isdir() function above. The first function checks if the said directory exists. If so, it returns True, else returns False. The second function checks if the path points to a directory. If so, it returns True, else returns False.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Using_LinuxUnixMacOS\"><\/span>2. Using Linux\/Unix\/MacOS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>mkdir is the most common command used to create directories in Linux\/Unix and MacOS systems. It offers -p or &#8211;parent option, that automatically creates any missing parent directories. Also, it does not give any error if the directory to be created already exists. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir -p \/path\/to\/directory<\/pre>\n\n\n\n<p>Here is the command to create directory <em>\/home\/ubuntu\/data\/project\/test<\/em>, along with its parent directories that do not exist.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir -p \/home\/ubuntu\/data\/project\/test<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Using_PowerShell\"><\/span>3. Using PowerShell<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Windows PowerShell is a command line shell in Windows systems that allows you to manage tasks and Windows system. It provides New-Item cmdlet that allows you to create directories in Windows. Here is the syntax of command to create new directory.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">New-Item -ItemType Directory -Path \"C:\\path\\to\\your\\directory\" -Force<\/pre>\n\n\n\n<p>In the above command, we use -ItemType option to specify that the new item to be created is a directory. We also use -Force option to disable error message in case the directory already exists. Here is the command to create directory c:\\home\\windows\\data\\project\\test.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">New-Item -ItemType Directory -Path \"C:\\home\\windows\\data\\project\\test\" -Force<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Using_Windows_Command_Prompt\"><\/span>4. Using Windows Command Prompt<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Like Linux, Windows also supports mkdir command. The only difference in this case is that you do not need to use -p or &#8211;parent option. Instead, you need to provide the full path to new directory. When you do this, mkdir will automatically create any missing parent directories. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir \"C:\\path\\to\\your\\directory\"<\/pre>\n\n\n\n<p>Here is the command to create directory <em>C:\\home\\win\\data\\project\\test<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir \"C:\\home\\win\\data\\project\\test\"<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt several easy ways to quickly create directory along with missing parent directories in your system. Depending on your requirement, you can do this programmatically or using OS commands. We learnt how to use os and pathlib modules to create directories using Python. We have also learnt how to do this for all operating systems &#8211; Windows, Linux and MacOS. We have also learnt how to suppress the error message, even if the directory to be created is already is already present. Depending on your requirement, you can use any of the above solutions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"FAQ\"><\/span>FAQ<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>1. Can we use pathlib on all Python versions?<\/strong><\/p>\n\n\n\n<p>No. Pathlib library is available on Python 3.5+. For older Python versions, you need to install pathlib2, a backport to pathlib module.<\/p>\n\n\n\n<p><strong>2. How to Create directory with missing parents in Linux\/Unix\/MacOS?<\/strong><\/p>\n\n\n\n<p>Use mkdir with -p option, followed by path to directory to be created.<\/p>\n\n\n\n<p><strong>3. How to create directory with missing parents in Python?<\/strong><\/p>\n\n\n\n<p>For Python 3.5+, use pathlib.Path.mkdir() function. For older Python versions, use os.path.mkdir() function.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/does-python-have-ternary-operator\/\">Does Python Have Ternary Operator?<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-read-large-file-in-python\/\">How to Read Large File in Python?<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-execute-system-command-in-python\/\">How to Execute System Command in Python?<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Software developers need to create directory with missing parent directory in Python. Here is how to do this.<\/p>\n","protected":false},"author":1,"featured_media":6054,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[301],"tags":[356,355],"class_list":["post-6026","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-create-directory","tag-missing-parent"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Create Directory with Missing Parent Directory - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Software developers need to create directory with missing parent directory in Python. Here is how to do this.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Create Directory with Missing Parent Directory - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Software developers need to create directory with missing parent directory in Python. Here is how to do this.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-18T10:23:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-02T07:21:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/12\/create-directory-missing-parent-python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"269\" \/>\n\t<meta property=\"og:image:height\" content=\"202\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Create Directory with Missing Parent Directory\",\"datePublished\":\"2024-12-18T10:23:43+00:00\",\"dateModified\":\"2026-02-02T07:21:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/\"},\"wordCount\":1154,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1\",\"keywords\":[\"create directory\",\"missing parent\"],\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/\",\"name\":\"How to Create Directory with Missing Parent Directory - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1\",\"datePublished\":\"2024-12-18T10:23:43+00:00\",\"dateModified\":\"2026-02-02T07:21:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Software developers need to create directory with missing parent directory in Python. Here is how to do this.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2024\\\/12\\\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1\",\"width\":269,\"height\":202,\"caption\":\"create directory with missing parent directories\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-create-directory-with-missing-parent-directory\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Create Directory with Missing Parent Directory\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Create Directory with Missing Parent Directory - Ubiq BI","description":"Software developers need to create directory with missing parent directory in Python. Here is how to do this.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/","og_locale":"en_US","og_type":"article","og_title":"How to Create Directory with Missing Parent Directory - Ubiq BI","og_description":"Software developers need to create directory with missing parent directory in Python. Here is how to do this.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2024-12-18T10:23:43+00:00","article_modified_time":"2026-02-02T07:21:05+00:00","og_image":[{"width":269,"height":202,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/12\/create-directory-missing-parent-python.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Create Directory with Missing Parent Directory","datePublished":"2024-12-18T10:23:43+00:00","dateModified":"2026-02-02T07:21:05+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/"},"wordCount":1154,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/12\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1","keywords":["create directory","missing parent"],"articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/","name":"How to Create Directory with Missing Parent Directory - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/12\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1","datePublished":"2024-12-18T10:23:43+00:00","dateModified":"2026-02-02T07:21:05+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Software developers need to create directory with missing parent directory in Python. Here is how to do this.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/12\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/12\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1","width":269,"height":202,"caption":"create directory with missing parent directories"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-create-directory-with-missing-parent-directory\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Create Directory with Missing Parent Directory"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/12\/create-directory-missing-parent-python.jpg?fit=269%2C202&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1zc","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=6026"}],"version-history":[{"count":35,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6026\/revisions"}],"predecessor-version":[{"id":10498,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/6026\/revisions\/10498"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/6054"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=6026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=6026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=6026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}