title: How to check if Directory already Exists in MFC(VC++)?
body: <p>How to check if Directory already Exists in MFC(VC++) ?
  I am using below code to get current application Path and there i am creating NDSLog folder 
  so that all my Logfiles should place there , now i want to check the condition if NDSLog folder already exists dont create it .How to do that ?</p>
  
  <p>Thanks.</p>
  
  <pre><code>char strPathName[_MAX_PATH];
      ::GetModuleFileName(NULL, strPathName, _MAX_PATH);
  
      // The following code will allow you to get the path.
      CString newPath(strPathName);
      int fpos = newPath.ReverseFind('\\');
  
      if (fpos != -1)
      newPath = newPath.Left(fpos+1);     
      newPath += "NDSLog\\" ;
  
      CreateDirectory(newPath,NULL); 
  </code></pre>