hexagon logo

How Do I List all files in a folder?

I would like to end up with an array that contains all filenames in a specified folder. I've cobbled together several ways to do this in VB from examples on the net, but none of them work with PC-DMIS's Cypress Enable crap.

How would I do this?

And can I grab specific properties of these files? Like Date/Time Modified?

Thanks!
Parents
  • For those of you looking to get file properties:


    Sub Main()
    Dim filespec As String
    filespec = "C:\TEST.TXT"
    Dim fs, f, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(filespec)
    s = UCase(filespec) & vbCrLf
    s = s & "Created: " & f.DateCreated & vbCrLf
    s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
    s = s & "Last Modified: " & f.DateLastModified
    MsgBox s, 0, "File Access Info"
    End Sub
Reply
  • For those of you looking to get file properties:


    Sub Main()
    Dim filespec As String
    filespec = "C:\TEST.TXT"
    Dim fs, f, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(filespec)
    s = UCase(filespec) & vbCrLf
    s = s & "Created: " & f.DateCreated & vbCrLf
    s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
    s = s & "Last Modified: " & f.DateLastModified
    MsgBox s, 0, "File Access Info"
    End Sub
Children
No Data