That's it!!!!!
Thanks a million Craig!
At 04:49 PM 8/13/01 +0100, you wrote:
>try this..
>
><cfparam name="dir" default="d:\">
>
><cfoutput>
><CFDIRECTORY ACTION="LIST" DIRECTORY="#dir#" NAME="test">
>
><cfset testCount = 0>
><cfset temp = "">
><cfloop query="test">
> <cfif type eq "Dir" and not ( name is "." or name is ".." )>
> <cfset temp = listappend(temp,#name#)>
> <cfset testCount = testCount + 1>
> Count: [#test.type#][#testCount#]<br>
> </cfif>
></cfloop>
>
> ListFirst:
>[#test.type#]#ListFirst(temp)#<br>
> ListLast: [#test.type#]#ListLast(temp)#
></cfoutput>
><hr>
><cfloop list="#temp#" index="i">
><cfoutput>#i#</cfoutput><br>
></cfloop>
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: 13 August 2001 16:42
>To: CF-Talk
>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?
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists