Here's the calling:
For Each s As DictionaryEntry In fileNameList("C:\AWDWIN")
Debug.WriteLine(s.Value)
Next
Here's the function:
Function fileNameList(ByVal directoryPath As String) As SortedList
Dim di As New IO.DirectoryInfo(directory
Dim fnSList As New SortedList
For Each f As IO.FileInfo In di.GetFiles
fnSList.Add(fnSList.Count + 1, f.Name)
Next
Return fnSList
End Function
Main Topics
Browse All Topics





by: plqPosted on 2006-10-17 at 13:58:51ID: 17752131
Have a look at the FileInfo object. Here's a useless piece of code out of my system that shows the use of these objects
ath & "\uploads")
Dim fld As System.IO.DirectoryInfo
Dim fil As System.IO.FileInfo
Dim lIndex As Integer
Dim sXML As String
Dim sFiles() As String
Dim sDates() As Date
fld = New System.IO.DirectoryInfo(sP
ReDim sFiles(500)
ReDim sDates(500)
lIndex = 0
For Each fil In fld.GetFiles()
lIndex = lIndex + 1
If UBound(sFiles) < lIndex Then
ReDim Preserve sFiles(UBound(sFiles) + 500)
ReDim Preserve sDates(UBound(sFiles) + 500)
End If
sFiles(lIndex) = fil.Name
sDates(lIndex) = fil.LastWriteTime
Next fil