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 determine a folder is empty

How to determine a folder is empty

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
5 Posts 5 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.
  • E Offline
    E Offline
    emmatty
    wrote on last edited by
    #1

    Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty

    T V D B 4 Replies Last reply
    0
    • E emmatty

      Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty

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

      emmatty wrote:

      Is there any single function to determine wether a folder is empty in VC++!

      AFAIK, there is no such function... I believe you have to make your own.. you can use CFileFind Class to achieve same...

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta VC Forum Q&A :- I/ IV

      1 Reply Last reply
      0
      • E emmatty

        Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty

        V Offline
        V Offline
        vikas amin
        wrote on last edited by
        #3

        There is not direct function in VC++(its not VB) but u can try finding the size of the folder but that u can find if its empty or not thank you :cool: Vikas Amin Embin Technology Bombay vikas.amin@embin.com

        1 Reply Last reply
        0
        • E emmatty

          Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Something like:

          bool IsFolderEmpty( LPCTSTR lpszFolder )
          {
          CFileFind fileFind;
          CString strFolder(lpszFolder);
          bool bFound,
          bEmpty = true;

          bFound = fileFind.FindFile(strFolder + \_T("\*.\*"));
          while (bFound != FALSE)
          {
              bFound = fileFind.FindNextFile();
              if (! fileFind.IsDots())
              {
                  bEmpty = false;
                  break;
              }
          }
          
          return bEmpty;
          

          }


          "Take only what you need and leave the land as you found it." - Native American Proverb

          1 Reply Last reply
          0
          • E emmatty

            Is there any single function to determine wether a folder is empty in VC++! Thanks in advance emmatty

            B Offline
            B Offline
            BambooMoon
            wrote on last edited by
            #5

            ::PathIsDirectoryEmpty()

            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