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
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 :
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:
PKZIP25 -ADD A:\GREENBAK.ZIP C:NOTES\DATA\GREENBAK.NSF (nb :all on 1 line)
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
For x = 1 To 200000
a = a +1
'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)
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)) & "%"
'now run the pkzip utility to backup to floppy
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)
This was first published in November 2000