Whatever message this page gives is out now! Go check it out!

GetCanonicalPath

Last update:
May 18, 2026

Description

Returns the canonical path string of the input path string. This function resolves the absolute path as well as the shorthands or redundant names like "." and "..". It also resolves the case of the drive letter in Windows.

Returns

The resolved file path.
Category

Function syntax

GetCanonicalPath( path )

See also

History

ColdFusion (2018 release) Update 1: Added the function.
ColdFusion (2016 release) Update 7: Added the function.

Parameters

Parameter
Description
path
Absolute or relative path of a directory or to a file.

Example

<cfscript>
 file1 = createObject("Java", "java.io.File")
 file1="C:/foo/bar/tmp/a.txt/"
 file2="c:\abc\..\abc\file.txt"
 writeOutput(getCanonicalPath(file1))
 writeOutput(getCanonicalPath(file2))
</cfscript>

Output

C:\foo\bar\tmp\a.txt
C:\abc\file.txt

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page