What is the simplest way in VB6 to loop through all the files in a specified folder directory and get their names?
+5
A:
sFilename = Dir(sFoldername)
Do While sFilename > ""
debug.print sFilename
sFilename = Dir()
Loop
DJ
2008-11-15 00:38:43
Damn, beat me to it :PHave an MSDN article for reference:http://msdn.microsoft.com/en-us/library/aa262726(VS.60).aspx
Peter C.
2008-11-15 00:42:27
+1
A:
DJ's solution is simple and effective, just throwing out another one in case you need a little more functionality that the FileSystemObject can provide (requires a reference to the Microsoft Scripting Runtime).
Dim fso As New FileSystemObject
Dim fol As Folder
Dim i As Integer
Set fol = fso.GetFolder("C:\")
For i = 0 To fol.Files.Count
Debug.Print fol.Files(i).Name
Next i
raven
2008-11-17 03:23:13