Re: Directory contents to list/array?

2008-07-23 Thread rex
You can also do Java's File Class, which returns an array.  I haven't 
done speed tests, but it *should* be faster for big directories:

listDirectory = 
createObject("java","java.io.File").init("/var/absolute/directory/path").list();

Let us know if it's faster for you

Melissa Cope wrote:
>> The query you get from cfdirectory is an array (or rather, its columns 
>> are):
>>
>> > yourCFFileQuery["name"][randRange(1,yourCFFileQuery.recordCount)]>
>> 
>
> I can't believe I didn't thank of that! Thanks so much. 
>
> 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309537
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Directory contents to list/array?

2008-07-23 Thread Melissa Cope
> The query you get from cfdirectory is an array (or rather, its columns 
> are):
> 
>  yourCFFileQuery["name"][randRange(1,yourCFFileQuery.recordCount)]>

I can't believe I didn't thank of that! Thanks so much. 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309535
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Directory contents to list/array?

2008-07-23 Thread Adrian Lynch
You don't necessarily need them in an array to do this. You can get at the
data with your chosen index like so:


#yourQuery["name"][yourRandomNumber]#


Adrian

-Original Message-
From: Melissa Cope [mailto:[EMAIL PROTECTED]
Sent: 23 July 2008 15:06
To: CF-Talk
Subject: Directory contents to list/array?


Here's the story: We have about 20 logos. We want a random four displayed.
In and of itself this is not very complicated, but a third party wants to
add and delete logos from the pool.

It seems to me that the easiest way to do this (once we put in a self-admin
section to upload/delete logos) would be to input the contents of the logo
directory into an array, then use randrange to choose positions in the array
(along with a listfind loop to make sure there aren't duplicates). My
problem is that I can't figure out how to transfer the cfdirectory results
to an array. Could you point me in the right direction? Thanks!


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309524
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Directory contents to list/array?

2008-07-23 Thread James Holmes
The query you get from cfdirectory is an array (or rather, its columns are):



On Wed, Jul 23, 2008 at 10:05 PM, Melissa Cope <[EMAIL PROTECTED]> wrote:
> Here's the story: We have about 20 logos. We want a random four displayed. In 
> and of itself this is not very complicated, but a third party wants to add 
> and delete logos from the pool.
>
> It seems to me that the easiest way to do this (once we put in a self-admin 
> section to upload/delete logos) would be to input the contents of the logo 
> directory into an array, then use randrange to choose positions in the array 
> (along with a listfind loop to make sure there aren't duplicates). My problem 
> is that I can't figure out how to transfer the cfdirectory results to an 
> array. Could you point me in the right direction? Thanks!

-- 
mxAjax / CFAjax docs and other useful articles:
http://www.bifrost.com.au/blog/

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309523
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Directory contents to list/array?

2008-07-23 Thread Melissa Cope
Here's the story: We have about 20 logos. We want a random four displayed. In 
and of itself this is not very complicated, but a third party wants to add and 
delete logos from the pool.

It seems to me that the easiest way to do this (once we put in a self-admin 
section to upload/delete logos) would be to input the contents of the logo 
directory into an array, then use randrange to choose positions in the array 
(along with a listfind loop to make sure there aren't duplicates). My problem 
is that I can't figure out how to transfer the cfdirectory results to an array. 
Could you point me in the right direction? Thanks! 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309522
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4