Results 1 to 8 of 8
  1. #1
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Redditch, Worcestershire, England
    Posts
    233
    Thanks
    0
    Thanked 22 Times in 21 Posts

    FileSearch replacement needed

    Currently using Office 97 on a new Windows 2000 PC. Just run into the problem described by KB article Q259738 - namely FileSearch fails with wildcards - in my case, the pattern *.mdb!!!

    Anyone got a good recursive file search routine they're willing to share, or point me at relevantr APIs? It's so long since I've had to write one from scratch, I'm afraid the required skills have faded from memory!!

    Thanks

    Jeremy

  2. #2
    kelliel
    Guest

    Re: FileSearch replacement needed

    The knowledge base article itself gives a work around (see <A target="_blank" HREF=http://support.microsoft.com/support/kb/articles/Q259/7/38.ASP>http://support.microsoft.com/support/kb/ar...s/Q259/7/38.ASP</A>). It worked for me, under Win98.

  3. #3
    3 Star Lounger
    Join Date
    Apr 2002
    Location
    Redditch, Worcestershire, England
    Posts
    233
    Thanks
    0
    Thanked 22 Times in 21 Posts

    Re: FileSearch replacement needed

    It looked like that would only work for files in the given folder, not ones in all subfolders too??

    Jeremy

  4. #4
    kelliel
    Guest

    Re: FileSearch replacement needed

    Ok. That need wasn't listed in your original post. That certainly does make a difference.

    BTW, just for sake of this thread, here is the code from the Knowledge Base article to which Jeremy and I are referring:

    <pre>
    <hr>Function TestDir(strPathName)
    Dim searchFile As String
    Dim resultString As String
    Dim fileCounter As Integer
    Dim messageString As String

    fileCounter = 0
    searchFile = Dir(strPathName)

    If searchFile <> "" Then
    fileCounter = 1
    resultString = searchFile & vbCrLf
    End If

    Do While searchFile <> ""
    searchFile = Dir
    If searchFile <> "" Then
    fileCounter = fileCounter + 1
    resultString = resultString & searchFile & vbCrLf
    End If
    Loop

    If fileCounter = 0 Then
    messageString = "No files found"
    Else
    messageString = "Found " & fileCounter & " file/s named:" _
    & vbCrLf & resultString
    End If

    TestDir = messageString
    End Function

    <hr>
    </pre>


  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSearch replacement needed

    I am today about to carve out the stuff from my Files processor. I'll post it either Thursday or Friday if you canw ait that long.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSearch replacement needed

    Try this.

    It's not my full-blown.

    I have two major features over this:

    (1) separate code for directories and file names - useful when I want to control the recursion myself. With this I can let the user specify "drill down no more than two levels of sub-directory".

    (2) separate code to let the user specify date-ranges, size ranges, sample sizes, whether random or not etc.
    Attached Files Attached Files

  7. #7
    Lounger
    Join Date
    Mar 2001
    Location
    NSW, Australia
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSearch replacement needed

    Thanks Chris

    This worked a treat in NT, however the same run-time error occurs in Windows 2000, due to the setting of strPathName = "*.*".

    Has anyone else overcome this problem ?

    I'm about to take a look at the Microsoft Article referred to.

    Thanks again Chris, I still have a use for your code in WindowsNT.

  8. #8
    Lounger
    Join Date
    Mar 2001
    Location
    NSW, Australia
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: FileSearch replacement needed

    Hi Jeremy
    I know this answer is very late, however - try replacing the asterisk with a slash - /.mdb - it worked for me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •