Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create File of files in a folder

Posted on 1998-08-22
1
Medium Priority
?
150 Views
Last Modified: 2010-04-30
How can I create a file that contains a listing of all of the files with a .dat extension?  Using vb on windows95.
0
Comment
Question by:Lee5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
fc_hnat earned 200 total points
ID: 1430428
Try this Lee5.
This
Private Sub Command1_Click()
   
    On Error GoTo ErrorHandler
     
    For x = 67 To 90
        Drive = Chr(x) & ":"
        ChDrive (Drive)
    Open "F:\MyFile" & Chr(x) & ".txt" For Output As #1
        MyFindFiles Drive & "\<path>", "*.*" ' replace path with folder.
    Close 1
10  Next
     
    MsgBox "Done."
     
    Exit Sub
     
ErrorHandler:
    Resume 10

End Sub
Private Sub MyFindFiles(ByVal sPath As String, ByVal sFilePattern As String)
    Dim sFile As String
    Dim coldir() As String
    Dim y As Integer
         
    On Error Resume Next
         
    sFile = Dir$(sPath & sFilePattern)
    While sFile <> ""
        If Left$(sFile, 1) <> "." Then
            Print #1, sPath & sFile
        End If
        sFile = Dir$
    Wend
             
    sFile = Dir$(sPath, 16)
    While sFile <> ""
        If Left$(sFile, 1) <> "." Then
            If GetAttr(sPath & sFile) And 16 Then
                y = y + 1
                ReDim Preserve coldir(y)
                coldir(y) = sPath & sFile & "\"
            End If
        End If
        sFile = Dir$
    Wend
         
    For z = 1 To y
        MyFindFiles coldir(z), sFilePattern
    Next
         
    Erase coldir
    y = 0

End Sub


0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question