Hello All,<br><br>I am trying to create a directory structure having 4 to 5 levels. When I try to call the boost::filesystem::create_directories(src); It throws an exception saying&nbsp; that path does not exist .So isn&#39;t create_directories() mean&#39;t for creating directory structure recursively or is there a other api which does it. I could not find Api&#39;s which can split&nbsp; the path ,and give the directory names in the path starting after the root directory up to leaf directory .
<br><br>I am attaching the sample code .<br><br>#include &lt;iostream&gt;<br>#include &quot;boost/filesystem/operations.hpp&quot;<br>#include &quot;boost/filesystem/path.hpp&quot;<br>#include &quot;boost/filesystem/convenience.hpp&quot; 
<br>int main()<br>{<br>&nbsp;&nbsp;&nbsp; const char* srcPath = &quot;C:\\tmp\\dir1\\dir2\\dir3\\&quot;; (this structure does not exist)<br>&nbsp;&nbsp;&nbsp; boost::filesystem::path src = boost::filesystem::path(srcPath, boost::filesystem::no_check); 
<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; boost::filesystem::create_directories(relativepath); // throws exception <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(src.has_branch_path())<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; boost::filesystem::path branchpath = src.branch_path
();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; branchpath.string();&nbsp;&nbsp; // prints C:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; boost::filesystem::path rootpath = src.root_path();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; rootpath.string();&nbsp; //prints C:<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; boost::filesystem::path relativepath = 
src.relative_path();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; relativepath.string(); //prints tmp\\dir1\\dir2\\dir3\\<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; catch(std::exception&amp; ex)
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; std::cout &lt;&lt; ex.what() &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; }<br><br>return 0;<br>}<br><br><br>Thanks in advance for the replies.<br><br>Rajesh <br>