Skip to main content
Known Participant
June 9, 2007
Question

Size of a directory

  • June 9, 2007
  • 3 replies
  • 318 views
I have a directory on our server with about 6000 files in it in subdirectories. I need to display to the user the size of all the files in the directory in GB if over 1GB and in MB if under 1GB. I figured CFDIRECTORY would give me the size of a directory but it returns 0 for directories. So does this mean I have to do a cfdirectory call (recursive) and then loop through every file and add up the size? If so, whats the math on that as far as figuring out gigabytes and megabytes (i suck at math lol) I did loop through everything and it returned 4320536649. So now what?

THANKS!!
    This topic has been closed for replies.

    3 replies

    Known Participant
    June 11, 2007
    AWESOME THANKS!!
    BKBK
    Community Expert
    Community Expert
    June 9, 2007
    So does this mean I have to do a cfdirectory call (recursive) and then loop through every file and add up the size?
    I'm afraid so. You could format the output as follows:

    Inspiring
    June 9, 2007