For some reason the code below lists the last file in the listing as a 
directory even though it is a file?

Try it out. Make sure you have some text files in your root directory.

<cfparam name="dir" default="d:\">

<cfoutput>
<CFDIRECTORY ACTION="LIST" DIRECTORY="#dir#" NAME="test">

<cfset testCount = 0>
<cfloop query="test">
<cfset temp = ValueList(test.name)>
        <cfif type eq "Dir">
           <cfset testCount = testCount + 1>
                  Count: [#test.type#][#testCount#]<br>
     </cfif>
</cfloop>

                                  ListFirst: [#test.type#]#ListFirst(temp)#<br>
                                  ListLast: [#test.type#]#ListLast(temp)#
</cfoutput>


This is my output:

Count: [Dir][1]
Count: [Dir][2]
Count: [Dir][3]
Count: [Dir][4]
Count: [Dir][5]
Count: [Dir][6]
Count: [Dir][7]
Count: [Dir][8]
ListFirst:[Dir] books
ListLast: [Dir] filename.txt

Note the file type on the ListLast output??

It *should* read LstLast: [File] filename.txt

What am I doing wrong?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to