User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 392,021 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,238 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:

Subfolder Search Loop

Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: Subfolder Search Loop

  #2  
Jul 19th, 2005
One solution that I'm fond of, in order to make VB search an entire drive is to shell a dos command of dir and redirect it into a file. Then open the file (which will contain a list of all paths to the files of a specific criteria), read in the paths line for line, and do something accordingly. For example:
dim wsh
dim PathList() as string
ReDim PathList(0)
set wsh = createobject("WScript.Shell")
wsh.run "dir /a/s/b z:\*.mdb >Z:\tmpfile.dat", 0, 1
open "z:\tmpfile.dat" for input as #1
     do until eof(1)
          line input #1, tmp
          PathList(ubound(PathList())) = tmp
          redim preserve PathList(UBound(PathList()) + 1)
     loop
close #1
kill "z:\tmpfile.dat"
That should work to load the string array PathList with a list of paths and filenames to MDB files.... if your system doesn't support Scripting (such as the createobject of wscript.shell) then you may need to use API calls (shellexecute) so that you can shell the dir command AND have it wait for the shell to complete before your VB code continues (what a mess it would be, trying to read from a file of paths that isn't done yet huh?). Let me know how it turns out, or if you need further assistance.
Reply With Quote  
All times are GMT -4. The time now is 10:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC