Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CF Pages - Do they exist?

Status
Not open for further replies.

JulieM

Programmer
Jun 6, 2001
25
0
0
GB
Can anyone help. We would like to check to see if a CF page exists on our CF Server. We know where it should be and what is should be called. Is there an easy way to find this out?

Thanks,

2 very new and confused CF Developers
 
Try:

FileExists
Returns YES if the file specified in the argument does exist; otherwise, it returns NO.

Syntax
FileExists(absolute_path)

absolute_path
Any absolute path.

<CFOUTPUT>
<CFSET vFilePath = &quot;C:\Inetpub\wwwroot\temp\test.cfm&quot;>
Does the file [COLOR=000080]<B>[/color]#VARIABLES.vFilePath#[COLOR=000080]</B>[/color] Exists? #FileExists(vFilePath)#[COLOR=000080]<BR>[/color]
</CFOUTPUT>

If you need to dynamically get the path of the file, but only have a relative path, you can use ExpandPath() to get the Absolute Path

ExpandPath
Returns a path equivalent to the relative_path appended to the base template path. Note the following:[ul]
[li]ExpandPath creates a platform-appropriate path. You can use either a slash (/) or a back slash (\) in the specified relative path.[/li][li]The return value contains a trailing slash (or back slash) if the specified relative path contains a trailing slash (or back slash).[/li]
[/ul]Syntax
ExpandPath(relative_path)

relative_path
Any relative path. ExpandPath converts relative directory references (.\ and ..\)to an absolute path. The function throws an error if this argument or the resulting absolute path is invalid.


<CFOUTPUT>
<CFSET vFilePath = ExpandPath(&quot;../temp/test.cfm&quot;)>
Does the file [COLOR=000080]<B>[/color]#VARIABLES.vFilePath#[COLOR=000080]</B>[/color] Exists? #FileExists(vFilePath)#[COLOR=000080]<BR>[/color]
</CFOUTPUT> - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top