Dir.RecursiveFindFile

Questions regarding syntax

Dir.RecursiveFindFile

Postby gbison » Mon Sep 12, 2011 8:02 pm

Hey guys,

As the subject states Im having a little trouble with this function. I have used it several times throughout my program with ease, but when using it for an ENTIRE drive (C:\) search for different images(*.jpg, *.png and *.bmp), it makes the program unstable (unresponsive) while its creating its list. It does in fact work as intended if you wait long enough, but its giving the perception that the program is locked up, when in fact it is not. Is there a better way to do massive file searches that has less impact on the program?

Thanks

Bryan
"The greatest trick the devil ever pulled was to convince the world he didn't exist" . ;-)
gbison
 
Posts: 29
Joined: Fri Feb 04, 2011 8:16 pm
Location: USA

Re: Dir.RecursiveFindFile

Postby Slowdown » Tue Sep 13, 2011 6:22 am

Hi Bryan,
to compare,
HD: 900GB with 582407 files
searching entire drive for *.jpg will take 4 minutes, 30 seconds with 15148 files found.
Regards
Slowdown for now i'm back
Slowdown
 
Posts: 347
Joined: Sat May 02, 2009 6:48 pm
Location: Netherlands

Re: Dir.RecursiveFindFile

Postby berndnoetscher » Tue Sep 13, 2011 7:02 am

gbison wrote:Hey guys,

As the subject states Im having a little trouble with this function. I have used it several times throughout my program with ease, but when using it for an ENTIRE drive (C:\) search for different images(*.jpg, *.png and *.bmp), it makes the program unstable (unresponsive) while its creating its list. It does in fact work as intended if you wait long enough, but its giving the perception that the program is locked up, when in fact it is not. Is there a better way to do massive file searches that has less impact on the program?

Thanks

Bryan


I would use Dir.RecursiveFindFile together with DoEvents, but instead of search C:\, I would create a list of sub directories of C:\ and use them in a loop together with DoEvents and Dir.RecursiveFindFile.
berndnoetscher
Site Admin
 
Posts: 1059
Joined: Tue Sep 25, 2007 9:37 am

Re: Dir.RecursiveFindFile

Postby Slowdown » Tue Sep 13, 2011 9:25 am

Best solution of both world is use as less as possible DoEvents() if speed is the most important for the app.
drawback is the the app will be less responsive.
Also don't update the tree-listview after each file found, this consumes time.
For instance update after each directory.
Did also a test with Q7B and have to say it's a bit faster.
(i know what the project is)
Regards
Slowdown for now i'm back
Slowdown
 
Posts: 347
Joined: Sat May 02, 2009 6:48 pm
Location: Netherlands

Re: Dir.RecursiveFindFile

Postby gbison » Tue Sep 13, 2011 8:03 pm

Thanks both of you....

@slowdown - yes you know ;)
Ill take your tests for comparison and advice as always.

@Bernd
I think I see in my head how you are doing this. I will muck about with it and holler if I have any questions.


Thanks Guys

Bryan
"The greatest trick the devil ever pulled was to convince the world he didn't exist" . ;-)
gbison
 
Posts: 29
Joined: Fri Feb 04, 2011 8:16 pm
Location: USA

Re: Dir.RecursiveFindFile

Postby dave_e » Wed Sep 14, 2011 1:30 pm

HI, in ref to SlowDown's mention of TreeView/ListView, I am reminded that Keyless items are bound to load faster because there is no unique test required when adding items to the control's collection; the more items, the more tests for uniqueness, the longer things take. Not sure if this is relevant but hoping it's somehow helpful.
Best Regards
Dave
dave_e
 
Posts: 10
Joined: Tue May 11, 2010 7:34 pm

Re: Dir.RecursiveFindFile

Postby gbison » Wed Sep 14, 2011 5:31 pm

I am reminded that Keyless items are bound to load faster because there is no unique test required when adding items to the control's collection; the more items, the more tests for uniqueness, the longer things take.


Thanks Dave, I have actually seen this take place already while trying to load 20,000 files into a list view. It does get slower....
"The greatest trick the devil ever pulled was to convince the world he didn't exist" . ;-)
gbison
 
Posts: 29
Joined: Fri Feb 04, 2011 8:16 pm
Location: USA


Return to Coding Questions

cron