Tip

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.