Re: Findfile in large directories [message #50684 is a reply to message #50632] |
Fri, 13 October 2006 03:25  |
Maarten[1]
Messages: 176 Registered: November 2005
|
Senior Member |
|
|
Wox wrote:
> In a widget application I'm making, I have "next file", "previous
> file" buttons which do the following:
[snip]
> The current loaded file is "list.path+list.file". SortListFiles sorts
> the files (in general not just string sort).
>
> However, in directories with up to 1000 or more files (usually also on
> an SMB mounted drive), this is rather slow (findfile takes most time).
Well, things will be slow on and SMB mounted drive, not much you can do
for that. How long does it take Windows Explorer to list all the files?
And does it get notified of changes quickly and reliably?
Using a cache to keep a list of the files is an option, but may be hard
if the directory contents change quickly. You may want to use
search_file with an approriate wildcard pattern to limit the list you
ask for to files that are likely to be next to the current file. This
pattern will depend on the file naming convention you have for this
directory (and please don't tell me that there is no convention for a
directory with 1000+ files).
Pre-structuring your data by educating your users to use subdirectories
and thereby limiting the number of files in a single directory might
also help.
Maarten
|
|
|