Greenbook - Accounting For Notes

Backup a 35Mbyte Notes file to a single Floppy Disk by clicking a Button and
display progress on the Status Bar.
By creating a New Copy of the NSF file, the major part of a NFS file, the View
Indexes, are not created until the file is opened for the first time. By the
zipping down the resultant indexless NSF file it will fit on a single floppy
disk.
The code below works off a Navigator Button labeled Backup.
The Notes Status Bar will display the Number of Documents to Copy, the Number
Copied, the Number Left to Copy and the % Complete.

Two Dos Batch files are used in conjunction with the LotusScript code.
1 - GREENDEL.BAT deletes any existing NSF file that will be re-created using
the db.CreateCopy command.
The contents of this BAT file is as follows :
DEL C:\NOTES\DATA\GREENBAK.NSF

2 - GREENBKU.BAT will call the pkzip utility to zip the file down onto a floppy.
The contents of this BAT file is as follows:
DIR A:\
PAUSE
DEL A:\*.*
PKZIP25 -ADD A:\GREENBAK.ZIP C:NOTES\DATA\GREENBAK.NSF (nb :all on 1 line)
DIR A:\
PAUSE

The LotusScript code is as follows :

Sub Click(Source As Navigator)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim newdb As NotesDatabase
Dim replica As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim x, a As Double
Set db = session.CurrentDatabase
Dim taskId As Integer
taskId% = Shell("GREENDEL.BAT" , 1)

'wait for deletion to happen
Beep
For x = 1 To 200000
a = a +1
Next

'now create a new copy if the db
Msgbox "A new empty copy of Greenbook will now be created and then all the
documents will be copied"
Set newdb = db.CreateCopy( "", "Greenbak.nsf" )
Set collection = db.AllDocuments
For x = 1 To collection.Count
Set doc = collection.GetNthDocument(x)
Call doc.CopyToDatabase(newdb)
Print "Documents to Copy : " & Cstr(collection.count) & " :
Copied : " & Cstr(x) & " Left to Copy : " & Cstr(collection.count - x)&
" Percent Complete : " & Cstr(Fix(x / collection.count * 100)) & "%"
Next

'now run the pkzip utility to backup to floppy
Beep
reply = Msgbox ("DATA COMPRESSION and COPY to FLOPPY will now occur" &
Chr(10) & Chr(10) & "PLACE FLOPPY DISK IN DRIVE NOW" , 17 , "FLOPPY COPY")
If reply <> 1 Then Exit Sub
taskId% = Shell("GREENBKU.BAT" , 1)

End Sub
This was first published in November 2000

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close