comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Findfile in large directories
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Findfile in large directories [message #50595] Mon, 09 October 2006 06:00 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Wox writes:

> FILE_SEARCH makes it even slower.

Well, now it's finding all the files. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Findfile in large directories [message #50596 is a reply to message #50595] Mon, 09 October 2006 03:35 Go to previous messageGo to next message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
Keep the paths in an array - don't read them every time. Sometimes it
takes a long time to get a directory listing when there are so many. If
you're adding files to the list, you might want to keep track of them
yourself.

regards,
Greg




Wox wrote:
> On Fri, 6 Oct 2006 08:22:43 -0600, David Fanning <davidf@dfanning.com>
> wrote:
>>
>> FINDFILE is obsolete. Have you tried FILE_SEARCH?
>> No idea if it would be faster or not. I'd have guessed
>> the sorting would be the bottleneck here.
>>
>> Cheers,
>>
>> David
>
> FILE_SEARCH makes it even slower.
Re: Findfile in large directories [message #50598 is a reply to message #50596] Mon, 09 October 2006 00:14 Go to previous messageGo to next message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On Fri, 6 Oct 2006 08:22:43 -0600, David Fanning <davidf@dfanning.com>
wrote:
>
> FINDFILE is obsolete. Have you tried FILE_SEARCH?
> No idea if it would be faster or not. I'd have guessed
> the sorting would be the bottleneck here.
>
> Cheers,
>
> David

FILE_SEARCH makes it even slower.
Re: Findfile in large directories [message #50624 is a reply to message #50598] Fri, 06 October 2006 11:26 Go to previous messageGo to next message
George N. White III is currently offline  George N. White III
Messages: 56
Registered: September 2000
Member
On Fri, 6 Oct 2006, Wox wrote:

> Dear All,
>
> In a widget application I'm making, I have "next file", "previous
> file" buttons which do the following:
> ...
> path = findfile(list.path+'*'+list.Format)
> nfiles = n_elements(path)
> path = SortListFiles(path,list.sortmethod,list.sortseparator)
> ind = where(path eq list.path+list.file,count)
> ...
> <take next or previous file (if any) and read/display it>
> ...
>
> 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).
>
> Any ideas how to make this faster?

If the contents of the directories are not updated too often you can
generate a cached list of the files. This is essentially what is done by
most TeX (math typesetting) implementations, using the unix "ls -R"
command to cache the names for a directory tree.

--
George N. White III <aa056@chebucto.ns.ca>
Re: Findfile in large directories [message #50631 is a reply to message #50624] Fri, 06 October 2006 07:22 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Wox writes:

> In a widget application I'm making, I have "next file", "previous
> file" buttons which do the following:
> ...
> path = findfile(list.path+'*'+list.Format)
> nfiles = n_elements(path)
> path = SortListFiles(path,list.sortmethod,list.sortseparator)
> ind = where(path eq list.path+list.file,count)
> ...
> <take next or previous file (if any) and read/display it>
> ...
>
> 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).
>
> Any ideas how to make this faster?

FINDFILE is obsolete. Have you tried FILE_SEARCH?
No idea if it would be faster or not. I'd have guessed
the sorting would be the bottleneck here.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Findfile in large directories [message #50686 is a reply to message #50596] Fri, 13 October 2006 01:03 Go to previous message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
Unfortunatly, the directory content is changing all the time and I
don't know how many files will be dumped at any given moment, so
keeping track of the list myself will be difficult (offcourse having
the "dumping" applications notify me when and what they are dumping
might be an option, I will look into that.)

Anyway, thanks to all for your replies.

On 9 Oct 2006 03:35:45 -0700, "greg michael" <greg.michael@gmail.com>
wrote:

>
> Keep the paths in an array - don't read them every time. Sometimes it
> takes a long time to get a directory listing when there are so many. If
> you're adding files to the list, you might want to keep track of them
> yourself.
>
> regards,
> Greg
>
>
>
>
> Wox wrote:
>> On Fri, 6 Oct 2006 08:22:43 -0600, David Fanning <davidf@dfanning.com>
>> wrote:
>>>
>>> FINDFILE is obsolete. Have you tried FILE_SEARCH?
>>> No idea if it would be faster or not. I'd have guessed
>>> the sorting would be the bottleneck here.
>>>
>>> Cheers,
>>>
>>> David
>>
>> FILE_SEARCH makes it even slower.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: difference between icontour and contour?
Next Topic: Findfile in large directories

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 23:13:20 PDT 2025

Total time taken to generate the page: 0.32127 seconds