CFLib.org – Common Function Library Project

normalizeFilePath(filePath)

Last updated September 09, 2008

author

S. Isaac Dealey

Version: 0 | Requires: CF6 | Library: FileSysLib

Description:
Turns c:\path\/to//dir/../other into c:\path\to\other - file or directory must already exist.

Return Values:
Returns a string.

Example:

<cfoutput>Put your files here: #normalizeFilePath("c:\path\/to//dir/../other")#</cfoutput>

Parameters:

Name Description Required
filePath The file path to format. Yes

Full UDF Source:

/**
 * normalizes a file path to remove invalid slashes and extra dots.
 * 
 * @param filePath      The file path to format. (Required)
 * @return Returns a string. 
 * @author S. Isaac Dealey (info@turnkey.to) 
 * @version 0, September 9, 2008 
 */
function normalizeFilePath(filePath) {
return CreateObject("java","java.io.File").init(filePath).getCanonicalPath();
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson