Dim session As New NotesSession
Dim db As NotesDatabase
Dim dbdir As New NotesDBDirectory("")
Dim Stat As Long
Dim nlog As New NotesLog("Compact Utility")
Call nlog.OpenMailLog(session.username,"DB Compact Utility")
Set db = dbdir.GetFirstDatabase(Database)
Call db.Open("",db.Filepath)
On Error Resume Next
While Not (db Is Nothing)
Print "Compacting: " & db.FilePath
If db.PercentUsed < 90 Then
stat = db.Compact
If Err = 4005 Then
Call nlog.LogAction(db.FilePath & " is in use or not on workspace.")
Err = 0
Else
Call nlog.LogAction("Compacted " & db.FilePath & " bytes freed: " & Str(stat))
End If
Else
Call nlog.LogAction("Database " & db.FilePath & " already " & db.PercentUsed & " percent in use")
End If
Call db.Close()
Set db = dbdir.GetNextDatabase()
Call db.Open("",db.filepath)
Wend
Call nlog.Close
Messagebox("Finished Compacting")
provided by Julian Robichaux at nsftools.com.
Technorati tags: Show-N-Tell Thursday
Categories: Show-n-Tell Thursday_
1 comment:
Very nice Don. Glad to see someone take it a step further.
This could be a toolbar icon too I am thinking for someone else that just asked about pushing it out.
Post a Comment