Aaron Young
Jan 14th, 2000, 12:14 AM
Try something like:
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
N.B. If you do the Entire HDD it may take a while.
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com
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
N.B. If you do the Entire HDD it may take a while.
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com