Tags: application, automate, based, creating, dialog, folder, folders, mfc, microsoft, msdn, process, software, specific, structure, sub, visual

creating folders and sub folders

On Microsoft » Microsoft Visual C & C++

2,140 words with 4 Comments; publish: Thu, 07 Feb 2008 02:06:00 GMT; (32578.13, « »)

i'm creating an MFC dialog based application to automate the process of creating a specific folder and sub folder structure that we use all the time. Can anyone suggest / show me the best way of doing this?

also if i want to call another application form my dialog then is shellexecute teh best way of doing this or is there a nicer way of doing this?

i'd really appreciate any help / comments / suggestions...

thanx

All Comments

Leave a comment...

  • 4 Comments
    • u have to specify the path.

      CString newSubDir= PathStr + "\\" + FetchAppVal;

      _mkdir((LPCTSTR)newSubDir);

      if u want to create subfolders then call this function recursively.

      Rate the suggestion if u can so that I can see how much it helped u.

      #1; Sat, 10 Nov 2007 06:56:00 GMT
    • u have to specify the path.

      where Pathstr is a string consisting path name and

      FetchAppVal is a str consisting the folder name

      CString newSubDir= PathStr + "\\" + FetchAppVal;

      _mkdir((LPCTSTR)newSubDir);

      if u want to create subfolders then call this function recursively.

      Rate the suggestion if u can so that I can see how much it helped u.

      #2; Sat, 10 Nov 2007 06:57:00 GMT
    • Use CreateDirectory("C\\Folder, NULL); to create folders. Use CreateProcess(..) to fork a process.

      Gabriel.

      _

      Forever trusting who we are

      And nothing else matters - Metallica

      _

      #3; Sat, 10 Nov 2007 06:58:00 GMT
    • Well, here's a little trick I've kept with me for quite a while:

      Using the

      MakeSureDirectoryPathExists you can build the whole path with one simply function call:

      For example, if C:\Dir doesn't exist, and you want to create c:\dir\subdir\thirdsubdir\somedir\

      instead of having to create C:\dir and then c:\dir\subdir and then C:\dir\subdir\thirdsubdir, etc...

      All you need to do is call

      MakeSureDirectoryPathExists("c:\\dir\\subdir\\thirdsubdir\\somedir\\");

      Got a question? try looking it up in MSDN first. Msdn comes with the Visual Studio, and can be found at http://msdn.microsoft.com

      --===--

      I'm not here for the rates, but rating a post is a good way for me to know how much i helped.

      --===--

      Daniel

      #4; Sat, 10 Nov 2007 06:59:00 GMT