Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find a Directory and a List of Files
Message
 
To
28/09/2000 08:37:25
GW Gross
{Banned by Information Security Policy}
Lake Mary, Florida, United States
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00421964
Message ID:
00421979
Views:
17
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I have written the included code to find a subdirectory name and then create an array of all of the .mdb files in the subdirectory. Have I done a good job or is there a faster/more efficent way to do this? I used dynamic arrays to store the subdirectory names and the file names. The problem is that the subdirectory names will always be changing. The directory structure is as follows:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Hi GW. I have two suggestions. The first is this: you loop through every directory, and then go back and for each directory you look through all files.... why not put the second loop inside the first? Loop through all directories as you currently do, and at each directory, check if mdb files exist, and if so, add them to the array. I am not sure if this will speed anything up, but it will certainly make for tighter code...

... and (second) if you do this, I would forgo the use of arrays. Just add the file entries directly into the list box collection that you use at the end of the code.

So in other words, instead of this...
1)--- loop through directories and store to array
--- end loop through directories
2)--- loop through directories and store file names to new array
--- end second loop through directories
3)--- loop through array of file names and add to collection

You can do this
--- loop through directories
--- --- at each directory, loop through file names
--- --- --- add each file name to collection
--- --- send file name loop
--- end directory loop

Note: I haven't tested this, but it may be quicker to add everything to a separate collection, and then at the end, loop through this collection and AddItem to the list.... I don't know... but it's worth experimenting (just as in VFP it is quicker to write everything to a local array, then copy that array to the form property array). As I said, I am not sure -- juts worth a test. If you get different speeds, please post the info!

Hope this helps.
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Previous
Reply
Map
View

Click here to load this message in the networking platform