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. Calculate Folder size

Calculate Folder size

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
4 Posts 3 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.
  • D Offline
    D Offline
    dipali_be2003
    wrote on last edited by
    #1

    Hello Can anyone tell me how to calulate number of bytes on the disk for given folder?(Folder size)

    H G 2 Replies Last reply
    0
    • D dipali_be2003

      Hello Can anyone tell me how to calulate number of bytes on the disk for given folder?(Folder size)

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

      See here[^]maybe it is some helpful to you

      _**


      **_

      WhiteSky


      1 Reply Last reply
      0
      • D dipali_be2003

        Hello Can anyone tell me how to calulate number of bytes on the disk for given folder?(Folder size)

        G Offline
        G Offline
        G_S
        wrote on last edited by
        #3

        As far as i know there is no API for that I did need the same thing what I did was I created a recursive function enumerated all the file and added their size. Ex BOOL GetFolderSize(TCHAR* szRoot,__int64* i64Size) { FindFirstFile(...); do{ //IF FOLDER GetFolderSize( szSubPath,i64Size) //ELSE IF FILE Add its value }while(FindNextFile(hFind,&FindFileData)); FindClose(...); return(TRUE) } but keep in mind that the FindFile.. returns 2 unneeded values the "." and ".." that you should ignore otherwise you will enumerate forever i think

        G_S

        D 1 Reply Last reply
        0
        • G G_S

          As far as i know there is no API for that I did need the same thing what I did was I created a recursive function enumerated all the file and added their size. Ex BOOL GetFolderSize(TCHAR* szRoot,__int64* i64Size) { FindFirstFile(...); do{ //IF FOLDER GetFolderSize( szSubPath,i64Size) //ELSE IF FILE Add its value }while(FindNextFile(hFind,&FindFileData)); FindClose(...); return(TRUE) } but keep in mind that the FindFile.. returns 2 unneeded values the "." and ".." that you should ignore otherwise you will enumerate forever i think

          G_S

          D Offline
          D Offline
          dipali_be2003
          wrote on last edited by
          #4

          thanx

          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