What I’m trying to do is remove duplicate databases by comparing two servers. I need to create an array for each server, compare them to find duplicates then compare the documents to know for sure that it’s ok to delete. Here’s what I have so far… but I’m not sure the best way to get a doc count before deleting.
Sub Initialize
Dim session As NotesSession
Dim dbdir1 As New NotesDbDirectory(“Server1”)
Dim dbdir2 As New NotesDbDirectory(“Server2”)
Dim db1 As NotesDatabase, db2 As NotesDatabase
Dim z As Variant
Dim dirlist1() As String, dirlist2() As String
Dim ctr As Integer
On Error Goto ErrHndlr
Open “c:\dblist.txt” For Output As #1
ctr = -1
Set db1 = dbdir1.GetFirstDatabase(DATABASE)
While Not (db1 Is Nothing)
ctr = ctr + 1
Redim Preserve dirlist1(ctr)
dirlist1(ctr) = db1.FileName
Set db1 = dbdir1.GetNextDatabase
Wend
ctr = -1
Set db2 = dbdir2.GetFirstDatabase(DATABASE)
While Not (db2 Is Nothing)
ctr = ctr + 1
Redim Preserve dirlist2(ctr)
dirlist2(ctr) = db2.FileName
Set db2 = dbdir2.GetNextDatabase
Wend
Print #1, “Server1 dbs also on Server2”
For x = 0 To Ubound(dirlist2)
z = Arraygetindex(dirlist1, dirlist2(x), 5)
If Not Isnull(z) Then
Print #1, dirlist2(x)
End If
Next
Exit Sub
ErrHndlr:
Print #1, Cstr(Err) & " " & Error & " " & Cstr(Erl)
Resume Next
End Sub