GetCanonicalPath

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

System functions

Function syntax

GetCanonicalPath( path )

See also

FileOpen

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

 Adobe

쉽고 빠르게 지원 받기

신규 사용자이신가요?