Solved

Display the Folder or directory size Coldfusion Application

Posted on 2008-06-26
3
315 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
ID: 21878324
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
ID: 31471150
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
ID: 21882626
glad i could help


thanks for the points
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 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

23 Experts available now in Live!

Get 1:1 Help Now