How can I display a recursive directory listing?
With the following code you get a directory view of the directory and all sub-dirs of the current directory. Name the file recursive.cfm otherwise it won't work
Only show directory tree:
<cfparam name="attributes.currentDir" default="#GetDirectoryFromPath(GetTemplatePath())#">
<cfdirectory directory="#attributes.currentDir#" action="list" name="getDir" sort="type">
<cfoutput query="getDir">
<cfif not compareNoCase(type,"dir")>
#name#<br>
<blockquote>
<cfmodule template="recursive.cfm" currentDir="#attributes.currentDir##name#\">
</blockquote>
</cfif>
</cfoutput>
Show directory and files:
<cfparam name="attributes.currentDir" default="#GetDirectoryFromPath(GetTemplatePath())#">
<cfdirectory directory="#attributes.currentDir#" action="list" name="getDir" sort="type">
<cfoutput query="getDir">
<cfif not compareNoCase(type,"dir")>
<strong>#name#</strong><br>
<blockquote>
<cfmodule template="recursive.cfm" currentDir="#attributes.currentDir##name#\">
</blockquote>
<cfelse>
#name#<br>
</cfif>
</cfoutput>
9571 viewed | Your opinion... | del.icio.us | Digg it | Tjarko @ 24/11/02 0:00 cet



