mmm...

mypath = getbasetemplatepath();
mypath = Left(mypath,len(mypath)-Len(ListLast,mypath,"/\"));

RemoveChars removes from the left side rather than the right ...

Though it probably is faster -- For some reason I just have an easier time
typing / reading the reverse() syntax...

If I were going to use this functionality frequently I wouldn't use either
of these -- I'd performance test each, place the better one in a UDF and use
the UDF...  :)


Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

> actually I believe removeChars(len(listLast(...))) is
> faster than reverse(),
> but I could be wrong.  Not that it really matters unless
> you're doing it in
> a loop...

> +-----------------------------------------------+
> Bryan Love
>   Macromedia Certified Professional
>   Internet Application Developer
>   Database Analyst
> TeleCommunication Systems
> [EMAIL PROTECTED]
> +-----------------------------------------------+

> "...'If there must be trouble, let it be in my day, that
> my child may have
> peace'..."
>       - Thomas Paine, The American Crisis



> -----Original Message-----
> From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 11, 2002 12:27 PM
> To: CF-Talk
> Subject: RE: cfdirectory


> There is also a non regex solution that's fairly simple:

> <cfset uppath =
> Reverse(ListRest(Reverse(Expandpath("")),"/\"))>

> Get the current base template directory, reverse it, drop
> the first element
> and reverse it again...


> Isaac Dealey
> Certified Advanced ColdFusion 5 Developer

> www.turnkey.to
> 954-776-0046

>> Oops.  Typo.  Too many parens.

>> Try:
>> <cfset uppath=rereplace(GetBaseTemplatePath(),
>> "[^\]+\\$", "")>

>> This isn't a tested copy, btw.  It's cut down from
>> something more complex
>> I
>> did.  But it ought to give a good idea of what to do,
>> even if it doesn't
>> work.  If it doesn't make sense, I'd be happy to explain,
>> but let's move
>> over to CF-RegEx where this particular solution would be
>> more on-topic.



>>   --Ben Doom
>>     Programmer & General Lackey
>>     Moonbow Software

>> : -----Original Message-----
>> : From: Webmaster [mailto:[EMAIL PROTECTED]]
>> : Sent: Wednesday, September 11, 2002 1:33 PM
>> : To: CF-Talk
>> : Subject: RE: cfdirectory
>> :
>> :
>> : I got this error when trying to do that..
>> :
>> :
>> : Error Diagnostic Information
>> : Just in time compilation error
>> :
>> : Invalid parser construct found on line 9 at position
>> 45. ColdFusion was
>> : looking at the following text:
>> :
>> : ,
>> : Invalid expression format. The usual cause is an error
>> in the expression
>> : structure.
>> :
>> :
>> :
>> :
>> : -----Original Message-----
>> : From: Ben Doom [mailto:[EMAIL PROTECTED]]
>> : Sent: Wednesday, September 11, 2002 11:35 AM
>> : To: CF-Talk
>> : Subject: RE: cfdirectory
>> :
>> :
>> : It's easy enough to get the current directory and strip
>> off the
>> : last folder.
>> : Something like:
>> :
>> : <cfset uppath=rereplace(GetBaseTemplatePath()),
>> "[^\]+\\$", "")>
>> :
>> : There may be a more efficient way to do this (anyone?)
>> but this type of
>> : thing has worked for me.
>> :
>> :
>> :
>> :   --Ben Doom
>> :     Programmer & General Lackey
>> :     Moonbow Software
>> :
>> : : -----Original Message-----
>> : : From: Webmaster [mailto:[EMAIL PROTECTED]]
>> : : Sent: Wednesday, September 11, 2002 12:32 PM
>> : : To: CF-Talk
>> : : Subject: cfdirectory
>> : :
>> : :
>> : : Is there any way to use cfdirectory this way in CF
>> 4.5:
>> : :
>> : : <cfdirectory ACTION="directory action"
>> : :     DIRECTORY="../directory/files">
>> : :
>> : : I know if I do it this way it will work.
>> : :
>> : : <cfdirectory ACTION="directory action"
>> : :     DIRECTORY="c:\directory\files">
>> : :
>> : :
>> : :
>> :
>> :
>>

> __________________________________________________________
> ____________
> Signup for the Fusion Authority news alert and keep up
> with the latest news in ColdFusion and related topics.
> http://www.fusionauthority.com/signup.cfm
> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
> Archives:
> http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe:
> http://www.houseoffusion.com/index.cfm?sidebar=lists


______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to