home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows the use of DirectoryExists --->
- <HTML>
- <HEAD>
- <TITLE>
- DirectoryExists Example
- </TITLE>
- </HEAD>
-
- <BODY bgcolor=silver>
- <H3>DirectoryExists Example</H3>
-
- <CFSET thisPath="#ExpandPath("*.*")#">
- <CFSET thisDirectory="#GetDirectoryFromPath("#thisPath#")#">
- <CFSET thisDirectory=#Left("#thisDirectory#", "#Evaluate("#Len("#thisDirectory#")# - 1")#")#>
-
- <CFOUTPUT>
- The current directory is: #GetDirectoryFromPath("#thisPath#")#
- <CFIF IsDefined("form.yourDirectory")>
- <CFIF form.yourDirectory is not "">
- <CFSET yourDirectory = form.yourDirectory>
- <CFIF DirectoryExists(#yourdirectory#)>
- <P>Your directory exists. You entered
- a valid directory name, #yourdirectory#
-
- Here are the contents of your directory:
- <CFDIRECTORY DIRECTORY="#yourDirectory#"
- NAME="myDirectory"
- SORT="name ASC, size DESC">
- <!--- Output the contents of the CFDIRECTORY as a CFTABLE --->
- <CFTABLE QUERY="myDirectory">
- <CFCOL HEADER="NAME:"
- TEXT="#Name#">
- <CFCOL HEADER="SIZE:"
- TEXT="#Size#">
- </CFTABLE>
- <CFELSE>
- <P>Your directory, #form.yourDirectory#, was not found
- </CFIF>
- </CFIF>
- <CFELSE>
- <H3>Please enter a directory path</H3>
- </CFIF>
- </CFOUTPUT>
-
- <FORM action="directoryexists.cfm" METHOD="post">
- <H3>Enter the path name of a directory accessible from this computer <I><FONT SIZE="-1">(try <CFOUTPUT>#thisdirectory#</CFOUTPUT>)</FONT></I></H3>
-
- <INPUT TYPE="Text" NAME="yourDirectory" value="<CFOUTPUT>#thisdirectory#</CFOUTPUT>">
- <INPUT TYPE="Submit" NAME="">
- </FORM>
-
- </BODY>
- </HTML>
-