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. Get the size of a specified folder

Get the size of a specified folder

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 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.
  • C Offline
    C Offline
    Cheickna
    wrote on last edited by
    #1

    Hi, I want to get the size of a specified folder like this : HANDLE hDir = CreateFile ("C:\\MyFolder", GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL ); Then i pass a directory handle to the GetFileSize function DWORD isize = GetFileSize(hDir, NULL /*lpfilesize*/ ); This code don't work. I try this second function : PLARGE_INTEGER lpFileSize; GetFileSizeEx( hDir, lpFileSize ); It don't work Can anybody help me. Thanks in advance

    L C 2 Replies Last reply
    0
    • C Cheickna

      Hi, I want to get the size of a specified folder like this : HANDLE hDir = CreateFile ("C:\\MyFolder", GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL ); Then i pass a directory handle to the GetFileSize function DWORD isize = GetFileSize(hDir, NULL /*lpfilesize*/ ); This code don't work. I try this second function : PLARGE_INTEGER lpFileSize; GetFileSizeEx( hDir, lpFileSize ); It don't work Can anybody help me. Thanks in advance

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      ummm a folder doesn't have a size as such ... its the sum of the sizes of all the files / folders in the folder do a recursive filesize thing and add them all together :suss:


      "... and so i said to him ... if it can't dance and you can't eat it either f**k it or throw it away"
      8028finder.com

      1 Reply Last reply
      0
      • C Cheickna

        Hi, I want to get the size of a specified folder like this : HANDLE hDir = CreateFile ("C:\\MyFolder", GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL ); Then i pass a directory handle to the GetFileSize function DWORD isize = GetFileSize(hDir, NULL /*lpfilesize*/ ); This code don't work. I try this second function : PLARGE_INTEGER lpFileSize; GetFileSizeEx( hDir, lpFileSize ); It don't work Can anybody help me. Thanks in advance

        C Offline
        C Offline
        Carlos Antollini
        wrote on last edited by
        #3

        No, you need to get the size of each file in the folder...;) Best Reagards... Carlos Antollini. www.wanakostudios.com Sonork ID 100.10529 cantollini

        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