home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / directoryexists.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.5 KB  |  54 lines

  1. <!--- This example shows the use of DirectoryExists --->
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. DirectoryExists Example
  6. </TITLE>
  7. </HEAD>
  8.  
  9. <BODY bgcolor=silver>
  10. <H3>DirectoryExists Example</H3>
  11.  
  12. <CFSET thisPath="#ExpandPath("*.*")#">
  13. <CFSET thisDirectory="#GetDirectoryFromPath("#thisPath#")#">
  14. <CFSET thisDirectory=#Left("#thisDirectory#", "#Evaluate("#Len("#thisDirectory#")# - 1")#")#>
  15.  
  16. <CFOUTPUT>
  17. The current directory is: #GetDirectoryFromPath("#thisPath#")#
  18. <CFIF IsDefined("form.yourDirectory")>
  19. <CFIF form.yourDirectory is not "">
  20. <CFSET yourDirectory = form.yourDirectory>
  21.     <CFIF DirectoryExists(#yourdirectory#)>
  22.     <P>Your directory exists.  You entered
  23.     a valid directory name, #yourdirectory#
  24.  
  25.     Here are the contents of your directory:
  26.     <CFDIRECTORY DIRECTORY="#yourDirectory#"
  27.     NAME="myDirectory"
  28.     SORT="name ASC, size DESC">
  29.     <!--- Output the contents of the CFDIRECTORY as a CFTABLE --->    
  30.     <CFTABLE QUERY="myDirectory">
  31.     <CFCOL HEADER="NAME:"
  32.             TEXT="#Name#">
  33.     <CFCOL HEADER="SIZE:"
  34.             TEXT="#Size#">
  35.     </CFTABLE>
  36.     <CFELSE>
  37.     <P>Your directory, #form.yourDirectory#, was not found
  38.         </CFIF>
  39. </CFIF>
  40. <CFELSE>
  41. <H3>Please enter a directory path</H3>
  42. </CFIF>
  43. </CFOUTPUT>
  44.  
  45. <FORM action="directoryexists.cfm" METHOD="post">
  46. <H3>Enter the path name of a directory accessible from this computer <I><FONT SIZE="-1">(try <CFOUTPUT>#thisdirectory#</CFOUTPUT>)</FONT></I></H3>
  47.  
  48. <INPUT TYPE="Text" NAME="yourDirectory" value="<CFOUTPUT>#thisdirectory#</CFOUTPUT>">
  49. <INPUT TYPE="Submit" NAME="">
  50. </FORM>
  51.  
  52. </BODY>
  53. </HTML>       
  54.