Dim strPath As String, strFile As String, strFileName As String Dim strNew As String, strTmp As String, lngF As LongstrPaht = "c:\docDir" strNew = "c:\New" strTmp = "C:\txtIndex.txt"strFile = Dir(strPaht & "\*.txt") If strFile <> "" Then strFileName = strFileName & strFile & vbCrLf Do Until strFile = "" strFile = Dir If strFile <> "" Then strFileName = strFileName & strFile & vbCrLf Loop lngF = FreeFile Open strTmp For Output As lngF Print #lngF, strFileName Close #lngF End If
Dim strNew As String, strTmp As String, lngF As LongstrPaht = "c:\docDir"
strNew = "c:\New"
strTmp = "C:\txtIndex.txt"strFile = Dir(strPaht & "\*.txt")
If strFile <> "" Then
strFileName = strFileName & strFile & vbCrLf
Do Until strFile = ""
strFile = Dir
If strFile <> "" Then strFileName = strFileName & strFile & vbCrLf
Loop
lngF = FreeFile
Open strTmp For Output As lngF
Print #lngF, strFileName
Close #lngF
End If