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. How to count no. of folders in a directory?

How to count no. of folders in a directory?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 Posts 6 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.
  • V Offline
    V Offline
    vandana7
    wrote on last edited by
    #1

    Hello Can i get help to count no. of folders in a directory.

    J M P H 4 Replies Last reply
    0
    • V vandana7

      Hello Can i get help to count no. of folders in a directory.

      J Offline
      J Offline
      Justin Perez
      wrote on last edited by
      #2

      Yes, you may. I have 10 fingers and 10 toes. What are you working with?

      I'm going to become rich when I create a device that allows me to punch people in the face over the internet. "If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer

      1 Reply Last reply
      0
      • V vandana7

        Hello Can i get help to count no. of folders in a directory.

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

        You could use FindFirstFile()/FindNextFile() and count only files with the FILE_ATTRIBUTE_DIRECTORY attribute. The code could be similar to this[^] Mark

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

        1 Reply Last reply
        0
        • V vandana7

          Hello Can i get help to count no. of folders in a directory.

          P Offline
          P Offline
          ptr_Electron
          wrote on last edited by
          #4

          int iCountDir=0; BOOL bWorkingff = Finderff.FindFile("*.*"); bWorkingff = Finderff.FindNextFile(); while(bWorkingff) { if (Finderff.IsDirectory()==TRUE) iCountDir++; bWorkingff = Finderff.FindNextFile(); } Finderff.Close() // iCountDir --Use it now

          1 Reply Last reply
          0
          • V vandana7

            Hello Can i get help to count no. of folders in a directory.

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

            See DlgDirList.

            T 1 Reply Last reply
            0
            • H Hamid Taebi

              See DlgDirList.

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              Hamid. wrote:

              DlgDirList

              does that return no of Directory in the folder?

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
              Never mind - my own stupidity is the source of every "problem" - Mixture

              cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

              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