> It works except for one thing. When I click on the link displaying the
directory
> structure I want listed from the database it only shows me the files
within that
> directory but  *no* subdirectories?
>

So what are you saying? That you want a directory browser that is restricted
at the top level eg. D:\ by COOKIE.DisplaySelect and listing directories
only, but isn't restricted after that?

So....

<!--- this code is in a template called dirtest.cfm --->
<cfparam name="url.directorypath" default="c:\">

<cfdirectory action="LIST" directory="#url.directorypath#" name="DirListing"
sort="type ASC, name ASC">

<cfcookie name="DisplaySelect" value="inetpub,mysql,winnt">

<cfoutput query="DirListing">
 <cfif DirListing.name IS "..">
  <cfset nextpath =
ListDeleteAt(url.directorypath,listlen(url.directorypath,"\"),"\")>
 <cfelseif DirListing.name IS ".">
  <cfset nextpath = url.directorypath>
 <cfelse>
  <cfset nextpath = url.directorypath&name&"\">
 </cfif>

    <cfif ListLen(url.directorypath,"\") EQ 1>
        <cfif DirListing.type IS "dir" AND
ListFindNoCase(cookie.DisplaySelect,DirListing.name)>
            <a href="dirtest.cfm?directorypath=#nextpath#">#name#</a><BR>
         </cfif>
 <cfelse>
  <cfif DirListing.type IS "dir">
            <a href="dirtest.cfm?directorypath=#nextpath#">#name#</a><BR>
  <cfelse>
  #name#<BR>
  </cfif>

    </cfif>
</cfoutput>

Be aware that this will not give you nice nested directory listings, but
only listings of the current folder, directories listed first followed by
files.

dirtest.cfm used in the link is the name of the file that contains this
code, so it is self referencing.  No need for one file for top level and
other files for other level directories.

Once again, change the names to protect the innocent... ;o)

Is this all making sense?

Regards

Stephen


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to