Solved

Display the Folder or directory size Coldfusion Application

Posted on 2008-06-26
3
314 Views
Last Modified: 2010-04-21
How do I obtain the folder size or the size of a directory I'm reading using cfdirectory?

I need to display the folder size or directory size
0
Comment
Question by:sweetbuttercup
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
James Rodgers earned 500 total points
Comment Utility
do you want it to be recuursive and do all subdirectories?
this does it from the current directory but easy to change to a dynamic directory start
<cfdirectory action="list" directory="#expandPath('.')#" name="fileList" sort="type,name">

<cfset totalBytes =0>

<cfloop query="fileList">

<cfif #type# is "dir">

<CF_DirSize dirPath="#expandPath('.')#\#name#"> 

<cfset totalBytes =#totalBytes# + #int(evaluate(message/1024))#>

<cfelse>

<cfset totalBytes =#totalBytes# + #int(evaluate(size/1024))#>

</cfif>

<cfoutput>

#attributes.dirPath#,#name#,#size#

</cfoutput>

</cfloop>

<cfset Caller.message = totalBytes>

Open in new window

0
 
LVL 1

Author Closing Comment

by:sweetbuttercup
Comment Utility
Very nice tag. While searching for CF_DIRSIZE, I actually found CF_FILESEARCH which is a new version of CF_DIRSIZE.  Never heard about them before. Works great!! Thanks a lot!!
0
 
LVL 25

Expert Comment

by:James Rodgers
Comment Utility
glad i could help


thanks for the points
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now