Search This Blog

Tuesday, October 29, 2013

ColdFusion: Useful Functions for Files and Directories/Folders

This blog entry is actually for myself. Sometimes, I get confused with the function names because the names are similar to each other. Below are the names and descriptions of their outputs.

<!--- Returns an absolute path from logical path (e.g., C:\inetpub\wwwroot\my_app\) --->
<cfoutput>#ExpandPath("\")#</cfoutput>

<!--- Returns the absolute path of the application base page (e.g., C:\inetpub\wwwroot\my_app\index.cfm) --->
<cfoutput>#GetBaseTemplatePath()#</cfoutput>

<!--- Returns the absolute path of the page (e.g., C:\inetpub\wwwroot\my_app\views\main\default.cfm) --->
<cfoutput>#GetCurrentTemplatePath()#</cfoutput>

<!--- Returns the directory from an absolute path (e.g., C:\inetpub\wwwroot\my_app\views\main\) --->
<cfoutput>#GetDirectoryFromPath(GetCurrentTemplatePath())#</cfoutput>

<!--- Returns the filename including the extension from an absolute path (e.g., default.cfm) --->
<cfoutput>#GetFileFromPath(GetCurrentTemplatePath())#</cfoutput>
<br />

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.