<HTML>
<HEAD>
<TITLE>&lt;CFDIRECTORY&gt; Example</TITLE>
</HEAD>
<BODY>
<!--- set default directory --->
<CFPARAM name="currentdirectory" default="C:\INETPUB\WWWROOT\OWS\CHAP35\"><!--- if passed in via URL parameter, was drilled down --->
<CFIF ISDEFINED("URL.SelectedDirectory")>
	<CFIF LISTLAST(URL.SELECTEDDIRECTORY,"\") IS "..">
		<CFSET CURRENTPATH = GETDIRECTORYFROMPATH(URL.SELECTEDDIRECTORY)>
		<CFSET CURRENTDIRECTORY = LISTDELETEAT(CURRENTPATH,LISTLEN(CURRENTPATH,"\"),"\")>
	<CFELSE>
		<CFSET CURRENTDIRECTORY = URL.SELECTEDDIRECTORY>
	</CFIF>
</CFIF>
	<!--- Execute the
<CFDIRECTORY>tag --->
<CFDIRECTORY action="LIST" directory="#currentdirectory#" name="DirectoryList"><!--- output the columnlist returned in the query as a result of the call --->
These columns are made available by the CFDIRECTORY tag :<BR>
<CFOUTPUT>
	#DirectoryList.columnlist#
</CFOUTPUT>
<BR><BR>
<TABLE>
	<TR>
		<TD colspan="7" align="center">			Currently Directory :
			<CFOUTPUT>
				#currentdirectory#
			</CFOUTPUT>
		</TD>
	</TR>
	<TR>
		<TD colspan="7" align="center">			Currently Available Files
		</TD>
	</TR>	<!--- output the results, skipping the "current" directory --->
	<CFOUTPUT query="DirectoryList">
		<CFIF NAME NEQ ".">
			<TR>
				<TD><!--- if file type is directory, set up link to drill down with a recursive call to this template --->
					<CFIF TYPE EQ "dir">
						<A href="CFDirectory.cfm?SelectedDirectory=#currentdirectory#\#name#">#name#</A>
					<CFELSE>
					<!--- otherwise create a link to the file --->
						<A href="#name#">#name#</A>
					</CFIF>
				</TD>
				<TD>&nbsp;&nbsp;</TD>
				<TD>#NumberFormat(Val(size/1024),"99999.99")#KB</TD>
				<TD>&nbsp;&nbsp;</TD>
				<TD>#DateFormat(DATELASTMODIFIED,"dd MMM YYYY")#  #TimeFormat(DATELASTMODIFIED,"hh:MM tt")#</TD>
				<TD>&nbsp;&nbsp;</TD>
				<TD>#type#</TD>
			</TR>
		</CFIF>
	</CFOUTPUT>
</TABLE>
</BODY>
</HTML>
