home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / directoryexists.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.7 KB  |  59 lines

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