Try something like:
N.B. If you do the Entire HDD it may take a while.Code:Private iFile As Integer Private Sub Command1_Click() iFile = FreeFile Open "C:\Log.txt" For Output As iFile Call LogFiles("*.*", "C:\") Close iFile Call Shell("notepad.exe C:\Log.txt", vbNormalFocus) End Sub Private Sub LogFiles(ByVal sFile As String, ByVal sStartDir As String) Dim sSubDirs() As String Dim iSubDirs As Integer Dim sDir As String If Right$(sStartDir, 1) <> "\" Then sStartDir = sStartDir & "\" sDir = Dir(sStartDir & sFile, vbArchive + vbDirectory + vbHidden + vbNormal + vbReadOnly + vbSystem) While Len(sDir) If Left$(sDir, 1) <> "." Then If (GetAttr(sStartDir & sDir) And vbDirectory) = vbDirectory Then ReDim Preserve sSubDirs(iSubDirs) sSubDirs(iSubDirs) = sDir iSubDirs = iSubDirs + 1 Else Print #iFile, sStartDir & sDir End If End If sDir = Dir Wend If iSubDirs Then For iSubDirs = 0 To iSubDirs - 1 Call LogFiles(sFile, sStartDir & sSubDirs(iSubDirs)) Next End If End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote