I have a cfquery that returns over 3000 records from a database. The specific column I am working with is called FILEPATH and it does indeed include file paths to a variety of files (.pdf, .txt, .doc, etc.)
Here are a couple of example results
share/open/global/robots.txt
share/open/global/recipes.txt
share/open/global/movies.txt
share/open/public/cars.txt
share/open/public/bikes.txt
share/open/public/desserts.txt
share/internal/file.txt
I am trying to parse out everything to the right of the last "/" in the string. So I'm looking to gather...
robots.txt
recipes.txt
movies.txt
cars.txt
etc.
I am able to use the following to create an array
<cfset theString="#checkDb.FILEPATH#"> <cfset theArray=ListToArray(theString, "/")> <cfdump var=#theArray[4]#>
Running this using the string "share/open/global/robots.txt" will indeed dump robots.txt
I then tried to loop through my database query in this manner:
<cfloop query="checkDb"> <cfset theString="#checkDb.FILEPATH#"> <cfset theArray=ListToArray(theString, "/")> <cfdump var=#theArray[4]#> </cfloop>
This does not work. Should this be an index loop? I have tried a handful of possibilities, with no success yet.
I just want to dump out a full list of the files without the filepaths.
Any insight will be greatly appreciated. Thanks!

New Topic/Question
Reply




MultiQuote




|