Thread: ListLast()

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    119
    Rep Power
    12

    ListLast()


    Hello,

    I know I can use

    currentscript=ListLast(cgi.script_name,"/");

    to get the name of a file -- the last entry after the "/" in the path to the file, culled from the web address.

    But, I really want to get the name of the *directory* that the file is in. Is there a function called something like

    ListSecondToLast() ???

    Thanks all,

    Laura S.
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,286
    Rep Power
    968
    This should do it:

    <cfoutput>
    #listGetAt( cgi.script_name, ( listLen( cgi.script_name, '/' ) - 1 ), '/' )#
    </cfoutput>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    119
    Rep Power
    12
    Thanks ... I also figured out that

    ListFirst(cgi.script_name,"/");

    will also work to get me the directory name I want, if the path to the file is only one level deep.

    Cheers,
    Laura S.

IMN logo majestic logo threadwatch logo seochat tools logo