It may be ugly, but you could add a column to the cfdirectory query
that contains the length of the "name" field, then QoQ that query
ordering by that value.

I.e,

<cfdirectory action="" directory="c:\path" name="foo">
<cfset queryAddColumn(foo, "metaOrder", arrayNew(1))>
<cfloop query="foo">
  <cfset querySetCell(foo, "metaOrder", len(foo.name[foo.currentRow]),
foo.currentRow)>
</cfloop>
<cfquery dbType="query" name="bar">
  SELECT name FROM foo ORDER BY metaOrder ASC
</cfquery>
<cfdump var="#bar#">

-joe

----- Original Message -----
From: Greg Luce <[EMAIL PROTECTED]>
Date: Mon, 28 Jun 2004 14:18:57 -0400
Subject: RE: Ordering File Names
To: CF-Talk <[EMAIL PROTECTED]>

Mikael,

You could grab the value after the '-' and stick it in an array

using the value as the key. Also put the full filename in the array. Then

sort the array using arraysort().

Greg



-----Original Message-----

From: Mickael [mailto:[EMAIL PROTECTED]

Sent: Monday, June 28, 2004 2:07 PM

To: CF-Talk

Subject: Re: Ordering File Names

I see, that is the only way to do it?

  ----- Original Message -----

  From: Burns, John D

  To: CF-Talk

  Sent: Monday, June 28, 2004 1:55 PM

  Subject: RE: Ordering File Names

  You need to make the numbers -01, -02 etc.  File systems order

  alphabetically, not numerically. If you can't get the files in a

  different format, you may want to run some kind of script to rename

  everything to take the number between - and . And convert it to a 3

  digit number.

  John

  -----Original Message-----

  From: Mickael [mailto:[EMAIL PROTECTED]

  Sent: Monday, June 28, 2004 1:53 PM

  To: CF-Talk

  Subject: Ordering File Names

  Hi All,

  I need to display file names from my directory on a page.  The file

  names are in the following format 1014133248-1.pdf, 1014133248-2.pdf,

  1014133248-3.pdf etc

  I need to display them in order, this works fine for files up to -9 but

  after that I end up with

  1014133248-1.pdf

  1014133248-11.pdf

  1014133248-12.pdf

  I am using CFDIRECTORY Then a Query of the output.  Is there a way to

  order them properly?

  Thanks

  Mike________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to