Since your ListLast: [#test.type#]#ListLast(temp)# is outside your loop and
you do not have any other checking, you do not have anything that says you
only want that to print the last directory. The file that is being listed is
the last one in the directory.
Dave Cahall
Vice President, Professional Services
Digitaris Technologies, Inc.
Office: 972.690.4131 ext 116
Mobil: 214.914.9947
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 13, 2001 10:43 AM
To: [EMAIL PROTECTED]
Subject: Re: <CFDIRECTORY..<CFLOOP trouble
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?
-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com
-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org
-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com
-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org