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.
The resolved file path.
Category
GetCanonicalPath( path ) |
ColdFusion (2018 release) Update 1: Added the function.
ColdFusion (2016 release) Update 7: Added the function.
Parameter |
Description |
|---|---|
path |
Absolute or relative path of a directory or to a file. |
<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>
C:\foo\bar\tmp\a.txt
C:\abc\file.txt
Sign in to your account