Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. create directory hierarchy

create directory hierarchy

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
15 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Roger Stoltz

    I bet what he's looking for is an obscure function called something like ::DoMySpecialThingRightNow() instead of an intuitive name like ::CreateDirectory().... I mean, who would ever think of that... :rolleyes:

    "It's supposed to be hard, otherwise anybody could do it!" - selfquote
    "High speed never compensates for wrong direction!" - unknown

    T Offline
    T Offline
    toxcct
    wrote on last edited by
    #4

    certainly :-D

    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

    1 Reply Last reply
    0
    • M MANISH RASTOGI

      Hi I want to create directory in hierarcy. For example I want to create c:\Test\Temp directory. Both test and temp directory do not exist. Thanks

      A Offline
      A Offline
      Alan Balkany
      wrote on last edited by
      #5

      The Boost libraries have a create_directories () function that does precisely this. See http://www.boost.org/doc/libs/1_35_0/boost/filesystem/convenience.hpp[^]

      M 1 Reply Last reply
      0
      • R Roger Stoltz

        I bet what he's looking for is an obscure function called something like ::DoMySpecialThingRightNow() instead of an intuitive name like ::CreateDirectory().... I mean, who would ever think of that... :rolleyes:

        "It's supposed to be hard, otherwise anybody could do it!" - selfquote
        "High speed never compensates for wrong direction!" - unknown

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #6

        Well CreateDirectory is useless. He actually needs CreateDirectoryHierarchy... :-D

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        M 1 Reply Last reply
        0
        • M MANISH RASTOGI

          Hi I want to create directory in hierarcy. For example I want to create c:\Test\Temp directory. Both test and temp directory do not exist. Thanks

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #7

          There's a lot of hard ways to do it... I prefer simple:

          ::SHCreateDirectory(NULL, L"c:\\Test\\Temp");

          *edit* While easy, I just noticed SHCreateDirectory[Ex] is deprecated. Bummer.

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          M 1 Reply Last reply
          0
          • M MANISH RASTOGI

            Hi I want to create directory in hierarcy. For example I want to create c:\Test\Temp directory. Both test and temp directory do not exist. Thanks

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #8

            Can you more explain because your answer is easy and you can saw some answers of friends?

            M 1 Reply Last reply
            0
            • M MANISH RASTOGI

              Hi I want to create directory in hierarcy. For example I want to create c:\Test\Temp directory. Both test and temp directory do not exist. Thanks

              B Offline
              B Offline
              Brij
              wrote on last edited by
              #9

              Please find the code below Using System.IO; //for creating the directory Directory.CreateDirectory("c:\\Test"); Directory.CreateDirectory("c:\\Test\\Temp");

              Cheers!! Brij

              M 1 Reply Last reply
              0
              • R Roger Stoltz

                I bet what he's looking for is an obscure function called something like ::DoMySpecialThingRightNow() instead of an intuitive name like ::CreateDirectory().... I mean, who would ever think of that... :rolleyes:

                "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                "High speed never compensates for wrong direction!" - unknown

                M Offline
                M Offline
                MANISH RASTOGI
                wrote on last edited by
                #10

                Hi, Actually CreateDirectory does not create all directories in hierarchy. I solved this problem by using MakeSureDirectoryPathExists. Thanks.

                1 Reply Last reply
                0
                • H Hamid Taebi

                  Can you more explain because your answer is easy and you can saw some answers of friends?

                  M Offline
                  M Offline
                  MANISH RASTOGI
                  wrote on last edited by
                  #11

                  Hi Hamid, Actually I want to create directory hierarcy using one api. CreateDirectory does not create directory hierarchy. I got MakeSureDirectoryPathExists API. If fulfils my requirement. Thanks

                  1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    Well CreateDirectory is useless. He actually needs CreateDirectoryHierarchy... :-D

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    M Offline
                    M Offline
                    MANISH RASTOGI
                    wrote on last edited by
                    #12

                    Hi, CreateDirectory does not create directory hierarchy. I would have to create each directory in hierarchy. I got solution. MakeSureDirectoryPathExists creates directory hierarchy. Thanks

                    1 Reply Last reply
                    0
                    • M Mark Salsbery

                      There's a lot of hard ways to do it... I prefer simple:

                      ::SHCreateDirectory(NULL, L"c:\\Test\\Temp");

                      *edit* While easy, I just noticed SHCreateDirectory[Ex] is deprecated. Bummer.

                      Mark Salsbery Microsoft MVP - Visual C++ :java:

                      M Offline
                      M Offline
                      MANISH RASTOGI
                      wrote on last edited by
                      #13

                      Hi, I used 'SHCreateDirectory' but got 'SHCreateDirectory': undeclared identifier. CreateDirectory API does not suite to my requirement becuase it creates directory only if parent directory exist. I got MakeSureDirectoryPathExists API which fulfil my requirements. Thanks for your help.

                      1 Reply Last reply
                      0
                      • B Brij

                        Please find the code below Using System.IO; //for creating the directory Directory.CreateDirectory("c:\\Test"); Directory.CreateDirectory("c:\\Test\\Temp");

                        Cheers!! Brij

                        M Offline
                        M Offline
                        MANISH RASTOGI
                        wrote on last edited by
                        #14

                        Hi, I was looking for WIN32 API. I got MakeSureDirectoryPathExists API. Thanks for your help.

                        1 Reply Last reply
                        0
                        • A Alan Balkany

                          The Boost libraries have a create_directories () function that does precisely this. See http://www.boost.org/doc/libs/1_35_0/boost/filesystem/convenience.hpp[^]

                          M Offline
                          M Offline
                          MANISH RASTOGI
                          wrote on last edited by
                          #15

                          Hi, I got the solution. I use MakeSureDirectoryPathExists API. Thanks for your response.

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups