Getting a file list from a folder

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
philspitler
Posts: 39
Joined: November 2nd, 2005, 10:20 am
Contact:

Does anybody know how the "getFiles" function determines which order to put the files in the array.

It doesn't seem to be alphabetical or by date modified.

It may be date created which is a bummer, I would love to have a flag to choose how it populates the array.

It looks like I may have to get the contents then have my script sort them into alphabetical order.

Any thoughts or words of wisdom?

Thanks.

Phil
Phil Spitler
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

Hey Phil,

When I was writing Immigration I came across the same problem. To make matters worse the results were different depending on whether the files were local or if they came from a server and different kinds of servers gave different results! A real pain! And then to make matters worse, it is super slow when retrieving tens of thousands of files which is a common task for immigration. This all let me to spend several months writing my own getFiles() function. The upside of all that was that I came up with something that not only worked as expected but was so much faster that it became of of the lead features of Immigration. You can browse a folder in immigration much faster than you can in the finder!

Sorry I don't have better news for you but just wanted to confirm your bug.

Lloyd
philspitler
Posts: 39
Joined: November 2nd, 2005, 10:20 am
Contact:

I was tinkering today and actually found the javascript sort() function worked great.

http://www.w3schools.com/jsref/jsref_sort.asp

Thanks for all your help.

Phil
Phil Spitler
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

The reason sort() didn't work for immigration is that it's slow and it's not a natural sort so 10 will be sorted between 1 and 2 which doesn't make it very useful for detecting file sequences.
philspitler
Posts: 39
Joined: November 2nd, 2005, 10:20 am
Contact:

ahhh, thanks for heads up.... I better do some more testing ;-)

Phil
Phil Spitler
Post Reply