House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Array a directory name

  << Previous Post |  RSS |  Tree View |  Sort Latest First |  Subscribe to this Group Next >> 

Array a directory name

How do you split a directory name into an array or remove a section from the Keith McGee 04/27/2012 11:04 AM
Did you try the listToArray function? Raymond Camden 04/27/2012 11:06 AM
I tried this Keith McGee 04/27/2012 11:11 AM
Um... so why did you provide 4 arguments? Raymond Camden 04/27/2012 11:14 AM
Oh - you were trying to include multichar delimiters. That was added Raymond Camden 04/27/2012 11:15 AM
it says 1-3 params, and you have used 4. Russ Michaels 04/27/2012 11:15 AM
Ok that worked, I'm using cf8. If I use a comma or forward slash as a delimiter Keith McGee 04/27/2012 11:28 AM
Figured it out, Keith McGee 04/27/2012 11:29 AM
Remember that Windows and Linux do this differently. Brian Thornton 04/27/2012 11:48 AM
>>newdir = tests/doc.html Claude_Schnéegans 04/27/2012 01:10 PM
If your example represents the exact scenario in all cases, I'd probably just Christopher Watson 04/27/2012 02:28 PM

04/27/2012 11:04 AM
Author: Keith McGee Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350850 How do you split a directory name into an array or remove a section from the name? Example dir = Internet/Manuals/tests/doc.html into newdir = tests/doc.html Thank you Keith
04/27/2012 11:06 AM
Author: Raymond Camden Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350851 Did you try the listToArray function? ----- Excess quoted text cut - see Original Post for more -----
04/27/2012 11:11 AM
Author: Keith McGee Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350852 I tried this <cfset arr = listToArray (filename, "/",false,true)> received this error Parameter validation error for the LISTTOARRAY function. The function accepts 1 to 3 parameters. The error occurred in repositoryView.cfm: line 14 12 :       <cfif right(downloadFilename, 3) eq 'htm'> 13 :             14 :             <cfset arr = listToArray (filename, "/",false,true)>
04/27/2012 11:14 AM
Author: Raymond Camden Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350853 Um... so why did you provide 4 arguments? ----- Excess quoted text cut - see Original Post for more -----
04/27/2012 11:15 AM
Author: Raymond Camden Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350854 Oh - you were trying to include multichar delimiters. That was added in CF9. But you aren't using a multichar delim so you don't need it. ----- Excess quoted text cut - see Original Post for more -----
04/27/2012 11:15 AM
Author: Russ Michaels Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350855 it says 1-3 params, and you have used 4. http://www.cfquickdocs.com/#ListToArray check the docs for your cf version, only cf9 support 4 params On Fri, Apr 27, 2012 at 4:11 PM, Keith McGee <kpmcgee@frontiernet.net>wrote: ----- Excess quoted text cut - see Original Post for more -----
04/27/2012 11:28 AM
Author: Keith McGee Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350856 Ok that worked, I'm using cf8. If I use a comma or forward slash as a delimiter doesn't error. Now if you use a backslash as a delimiter I get this error Unexpected internal error near index 3 :|\ ^ The error occurred in repositoryView.cfm: line 14 12 :       <cfif right(downloadFilename, 3) eq 'htm'> 13 :             14 :             <cfset arr = listToArray (filename, "\",true)>
04/27/2012 11:29 AM
Author: Keith McGee Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350857 Figured it out, Thank you guys
04/27/2012 11:48 AM
Author: Brian Thornton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350858 Remember that Windows and Linux do this differently. ----- Excess quoted text cut - see Original Post for more -----
04/27/2012 01:10 PM
Author: Claude_Schnéegans Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350859 >>newdir = tests/doc.html According to the example you give, what you're looking for is not an array but a substring. How about newdir = listGetAt(dir, listLen(dir, "/")-1, "/") & "/" & listLast(dir, "/")
04/27/2012 02:28 PM
Author: Christopher Watson Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:63879#350861 If your example represents the exact scenario in all cases, I'd probably just use GetFileFromPath() and GetDirectoryFromPath(), in conjunction with ListLast(): <!--- Where OldDir = Internet/Manuals/tests/doc.html ---> <cfset NewDir = "#ListLast(GetDirectoryFromPath(OldDir),'/')#/#GetFileFromPath(OldDir)#"> -Christopher ----- Excess quoted text cut - see Original Post for more -----
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 18, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference