Here's another Mark Taylor 30.Nov.18 10:57 PM a Web browser Notes Client All ReleasesAll Platforms
Here's another thing that i found way back then that helped me:
RE: Dir$ useless for recursive access to sub-directories
Posted by Gil Braun on 7.Jul.98 at 07:01 PM using a Web browser
Category: Notes Designer -- LotusScriptRelease: Platform:
This is working code that we use in a source code project manager database (it imports files from a dir and its recursive subdirs, as attachments into Notes docs describing each file), it contains what you want.
Option Public
Option Declare
Dim basePath As String
Sub GetProjectFiles(inDir As String, category As String)
Dim searchSpec As String
Dim dirName As String
Dim dirList() As String
Dim dirCount As Integer
Dim fileName As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rtItem As NotesRichTextItem
Dim view As NotesView
Dim dt As NotesDateTime
Dim key(1 To 2 ) As String
Dim stripCount As Integer
Dim partialPath As String
Set db = session.CurrentDatabase
Set view = db.GetView("Project Details")
Set doc = view.GetDocumentByKey(key,True)
If doc Is Nothing Then
If Len(partialPath) > 0 Then
Set doc = db.CreateDocument
doc.Form="Project"
doc.FileDateAndTime = "Directory"
doc.Category = category
doc.DocType = "Directory"
doc.ItemText = partialPath
Call doc.Save(True, True)
End If
End If
' Trap PATH NOT FOUND errors.
On Error 76 Resume Next
dirCount = 0
If Right(inDir,1) <> "\" Then
searchSpec = inDir & "\*.*"
Else
searchSpec = inDir & "*.*"
End If
dirName = Dir(searchSpec, 16)
Do While dirName <> ""
If dirName <> "." And dirName <> ".." Then Chdir (dirName)
If Curdir <> inDir Then
Chdir("..")
Redim Preserve dirList (dirCount)
dirList (dirCount) = dirName
dirCount = dirCount + 1
End If
dirName = Dir
Loop
' Now do the search for files
' getfiles
Call GetFiles(category, db, view, "*.htm", partialPath)
Call GetFiles(category, db, view, "*.gif", partialPath)
Call GetFiles(category, db, view, "*.jpg", partialPath)
Forall s In dirList
Call GetProjectFiles(s, category)
End Forall
Chdir ("..")
End Sub
Sub GetFiles(category As String, db As NotesDatabase, view As NotesView, spec As String, partialPath As String)
Dim doc As NotesDocument
Dim fileName As String
Dim key(1 To 2 ) As String
Dim hasChanged As Integer
Dim rtItem As NotesRichTextItem
If Not doc Is Nothing Then
If doc.FILEDATEANDTIME(0) = Filedatetime(Curdir & "\" & fileName) Then
hasChanged = False
Print "Skipping " & Curdir & "\" & fileName
Else
Call doc.Remove(True)
Msgbox Curdir & "\" & fileName & " has changed"
End If
End If
If hasChanged Then
Print "Importing " & Curdir & "\" & fileName
Set doc = db.CreateDocument
doc.Form="Project"
doc.Category = category
doc.DocType = "File"
doc.ItemText = partialPath & "\" & fileName
Set rtitem = New NotesRichTextItem( doc, "Attachment")
Call rtitem.EmbedObject(EMBED_ATTACHMENT, "", Curdir & "\" & fileName)
doc.FileDateAndTime= Filedatetime(Curdir & "\" & fileName)
Call doc.Save(True, True)
End If
fileName = Dir
Wend
End Sub
Sub Initialize
basePath = ""
End Sub