CFLib.org – Common Function Library Project

normalizeFilePath(filePath)

Last updated September 9, 2008

Version: 0 | Requires: ColdFusion MX | Library: FileSysLib

 
Rated 0 time(s). Average Rating: 0

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

Return Values:
Returns a string.

Example:

view plain print about
<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:

view plain print about
<cfscript>
/**
 * 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();
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Robby Lansaw Robby Lansaw added
getComponentProp...
3 day(s) ago

Dave Anderson Dave Anderson added
iniToStruct
25 day(s) ago

Dave Anderson Dave Anderson added
deDupeArray
25 day(s) ago

Richard Richard added
dice
27 day(s) ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 22 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Raymond Camden highlightAndCrop
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson