Results 1 to 2 of 2

Thread: Easy Path finding question Help Please!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    71
    I have some code that goes out and looks in a directory for a path that I give it. The path contains a Wildcard so that I can get all the paths like it. I need to be able to know what the path names are that are found. Currently my code looks like:

    Dim strSourceFilePath As String
    strSourceFilePath = "C:\testing\test*.txt"
    If Dir(strSourceFilePath, vbNormal) = "" Then
    MsgBox "Not Found"
    Else:
    'Need the paths found here!
    MsgBox "Found"
    End If

    What I have works, however I need to know what files are found that meet the "c:\testing\test*.txt" Criteria.
    In that dir I might have the following paths:
    c:\testing\test1-17-2001.txt
    c:\testing\test1-16-2001.txt
    c:\testing\test1-15-2001.txt
    I need a list of what's there. HELP!


  2. #2
    Addicted Member Babbalouie's Avatar
    Join Date
    Jan 2001
    Location
    On the bright, blue sea...
    Posts
    197

    Talking

    Dim strSourceFilePath As String
    strSourceFilePath = "C:\testing\test*.txt"

    strSourceFilePath = Dir(strSourceFilePath)

    If strSourceFilePath = "" then
    Msgbox "No files in path..."
    Else
    Do While Not strSourceFilePath = ""
    'Looping thru the filenames...
    strSourceFilePath = Dir()
    Loop
    End If

    The use of the second Dir(), with no parameters, conducts a second search using the same aprameters as the first Dir call.
    Building A Better Body Albeit Left Out Under Intense Extrapolation

Posting Permissions

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



Click Here to Expand Forum to Full Width