GetDirectoryFromPath

Description

Extracts the directory (with a backslash) from a fully specified path.

Category

System functions

Syntax


GetDirectoryFromPath(path) 

See also

ExpandPath, GetFileFromPath

Parameters

Parameter
Description
path
Fully specified path (drive, directory, filename, and extension)

Example

<!--- This example shows the use of GetDirectoryFromPath --->

<html>

<head>

<title>GetDirectoryFromPath Example</title>

</head>



<body bgcolor = silver>

<H3>GetDirectoryFromPath Example</H3>

<cfset thisPath = ExpandPath("*.*")>

<cfset thisDirectory = GetDirectoryFromPath(thisPath)>

<cfoutput>

The current directory is: #GetDirectoryFromPath(thisPath)#

<cfif IsDefined("FORM.yourFile")>

<cfif FORM.yourFile is not "">

<cfset yourFile = FORM.yourFile>

  <cfif FileExists(ExpandPath(yourfile))>

  <P>Your file exists in this directory. You entered   the correct 

  file name, #GetFileFromPath("#thisPath#/#yourfile#")#

  <cfelse>

  <P>Your file was not found in this directory:

  <BR>Here is a list of the other files in this directory:

  <!--- use CFDIRECTORY to give the contents of the

  snippets directory, order by name and size --->

  <CFDIRECTORY DIRECTORY = "#thisDirectory#"

  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#">





Banner.Novgorod.Ru