>- see footer for list info -<
> Is there a command that let's me convert...
> D:\Inetpub\sites\webroot\nicktest\thumbs\map_page_1.jpg
> into...
> /nicktest/thumbs/map_page_1.jpg

Not in Adobe ColdFusion (unless you use a UDF - see below).

Railo has the ContractPath function, partner to the ExpandPath, which
will contract an expanded path, (also making use of any mappings you
might have setup).


A simple way to replicate that (though without the mappings stuff)
could be a function like this:

<cffunction name="convertPath">
        <cfargument name="Input"/>
        <cfargument name="Relative" default="#GetBaseTemplatePath()#"/>

        <cfset var newInput = 
Replace(ExpandPath(Arguments.Input),'\','/','all')/>
        <cfset var newRelative = Replace(Arguments.Relative,'\','/','all')/>
        <cfset newRelative = REReplace(newRelative,'^(([^/]+/)+)[^/]*$','\1')/>

        <cfreturn ReplaceNoCase( newInput , newRelative , '')/>
</cffunction>

<cfset input = "D:\Inetpub\sites\webroot\nicktest\thumbs\map_page_1.jpg"/>
<cfset output = convertPath(input)/>


Possibly with some extra tweaks required depending on your exact situation.

_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to