Hello fam! It's been a while!! I am working on a project where I need
to be able to sort the results by the "directory size." I am using the
custom tag to pull back the cfdirectory info (folder sizes) and then
nesting another one within that to pull both the names and the
directory sizes.

I put the data in a structure and it is outputting fine, I just am
still having an issue with the sort. I think I have tried every
variation of StructSort(). Any help is greatly appreciated as always.
:)

<!--- Running the scan on the web hosting entire directory --->
                                        
<cfoutput><h1>#form.Server#</h1></cfoutput>
                                        <CF_DIRINFO 
BASEDIR="\\#form.server#BLAH" RECURSE="No"
DIRDELIMITER="," TREELIST="Yes">
                                        <!--- end slow part --->
                                        
                                        <!--Outputting the information about 
this root directory-->
                                        <cfoutput>
                                          <table cellpadding="7">
                                        <tr>
                                        <td width="192"><strong>Number of 
Subdirectories</strong></td>
<td width="137"><strong>Number of Files</strong></td> <td
width="136"><strong>Number of Levels</strong></td>
                                        </tr>
                                        <td>#DirInfo_Count#</td> 
<td>#DirInfo_FileCount#</td>
<td>#DirInfo_LevelCount#</td>
                                        </table>
                                        </cfoutput>
                                        
                                        <!--Loop through the individual 
subdirectories -->
                                        <table width="65%" border="1" 
cellpadding="6" cellspacing="0">
                                        <tr bgcolor="#FFCC00">
                                        <td 
width="43"><strong>Folder</strong></td>
                                        <td 
width="43"><strong>Size</strong></td>
                                        </tr>
                                        
                                        <cfset structDir = structnew()>
                                        <cfloop list="#DirInfo_List#" 
index="dir" delimiters="," >
                                                        <cfoutput>
                                                                        
<CF_DIRINFO BASEDIR="\\#server#\webprov$#dir#" RECURSE="no"
DIRDELIMITER="," TREELIST="No">
                                                                
                                                                                
                                                                                
<!--- <cfset structDir.directoryName = #dir#>
                                                                                
<cfset structDir.directorySize = #DirInfo_Size# --->
                                                                                
<cfset structDir["DirInfo"] = StructNew()>
                                                                                
<cfset structDir["DirInfo"].directoryName =#dir#>
                                                                                
<cfset structDir["DirInfo"].directorySize = #DirInfo_Size#> 
                                                                                
 
                                                                                
<cfloop list="#ArrayToList(StructSort(structDir, "NUMERIC",
"DESC", "#directorySize#"))#" index="i">
                                                                                
                        <tr>
                                                                                
                        <td>#structDir[i].directoryName# 
                                                                                
                        </td> 
                                                                                
                        <td> <cfif structDir[i].directorySize NEQ 0>
                                                                                
                                                        <cfset dirSizeKB = 
structDir[i].directorySize / 1024>
                                                                                
                                                        <cfset dirSizeMB = 
dirSizeKB / 1024>
                                                                                
                                                        
#NumberFormat(dirSizeMB, "____.__")# MB<br>
                                                                                
                                        <cfelse> 
                                                                                
                                                        0 bytes
                                                                                
                                        </cfif>
                                                                                
                        </td> 
                                                                                
                        </tr>
                                                                                
</cfloop>
                                                        </cfoutput>
                                        </cfloop>
  </table>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189557
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to