You'd think this would be built-in, huh? Here's something I hacked up
some time back. You save it as directorysize.cfm . Request.CFRoot is the
root folder of your site. It might choke on extremely large folders.
This is not very elegant and could be improved, but it works. 


<cfdirectory directory="#Request.CFRoot##Attributes.Directory#"
name="Directory">
<cfset CurrentDirectorySize = 0>
<cfloop query="Directory">
        <cfif (Type EQ "Dir") AND NOT ListFind(".,..", Name)>
                <cf_DirectorySize
Directory="#ListAppend(Attributes.Directory, Name, "\")#">
                <cfset CurrentDirectorySize = CurrentDirectorySize +
DirectorySize>
        <cfelse>
                <cfset CurrentDirectorySize = CurrentDirectorySize +
Size>
        </cfif>
</cfloop>

<cfset Caller.DirectorySize = CurrentDirectorySize>



Regards,
Matthew Walker
/*
        Cabbage Tree Creative Ltd
        Christchurch - New Zealand

        http://www.matthewwalker.net.nz/
        http://www.cabbagetree.co.nz/
*/


-----Original Message-----
From: Kevin Schmidt [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 16 April 2002 9:40 a.m.
To: CF-Talk
Subject: Directory Size


Hi Gang! 

 

Is there anyway to find out the total size of all files in a directory
including subfolders?  Similar to when you right click on the folder and
select properties.  A com object, or something like that?

 

Thanks,

 

Kevin 

 



______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to