Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

PreviousPrevious NextNext

Here's another
Mark Taylor 30.Nov.18 02:57 PM a Web browser
Notes Client All Releases All 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")

Chdir(inDir)
inDir = Curdir()
If basePath = "" Then basePath = inDir
stripCount = Len(basePath)
partialPath = Mid (inDir,stripCount + 1)

key(1) = category
key(2) = partialPath

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

fileName = Dir(spec, 15)
While fileName <> ""
hasChanged = True
key(1) = category
key(2) = partialPath & "\" & fileName
Set doc = view.GetDocumentByKey(key,True)

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




agent that finds file on the users ... (Baba Tony 30.Nov.18)
. . RE: agent that finds file on the us... (Mark Taylor 30.Nov.18)
. . Here's another (Mark Taylor 30.Nov.18)
. . ...and another... (Mark Taylor 30.Nov.18)


Document Options






  Document options
Print this pagePrint this page

Search this forum

Forum views and search


  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite