Solved

Display the Folder or directory size Coldfusion Application

Posted on 2008-06-26
3
335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

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

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
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 …
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

630 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