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?
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 = "C:\Inetpub\wwwroot\temp\test.cfm">
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("../temp/test.cfm")>
Does the file [COLOR=000080]<B>[/color]#VARIABLES.vFilePath#[COLOR=000080]</B>[/color] Exists? #FileExists(vFilePath)#[COLOR=000080]<BR>[/color] </CFOUTPUT> - tleish
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.