SBP ' Backup and Restore (via MSDOS callout of PKWARE products) ' of CURRENT DIRECTORY ' ********** so, get to where you want to backup before calling this ' ' ' Put together by John Barrs June 1996 ' ' Offered on 'as-is' basis with no guarantees and no comeback ' ' ***** in particular, the selection of files from ' ***** a zip file created with options other than those used here ' ***** may cause an apparent hang (in DOS) or other error if you ' ***** opt to select files from a zip file, because the structure ' ***** of the output is different and program may not detect the files ' ' NB: No errortrapping anywhere ' ' ' Feel free to modify, break, make or use as a dishrag ' ' ' Options: ' Backup ' To floppy drive or hard disk ' If floppy - span multiple floppies if necessary ' If floppy - optionally format ' Select Files from current directory or all ' (*.sb! and Superbas.net will appear in list and will not be copied) ' include directory structure or not ' ' Restore ' From floppy drive or hard disk ' Select files from zip file or all ' Overwrite existing files or not ' (if you choose not to then each will be prompted for in dos window) ' restore the directory structure or not ' ' ' ****************************************************************************** ' ' ********* Warning:: This will produce a Dos WINDOW if it needs to ' Basically the only time it will not produce a DOS Window is ' BackUp - if you chose hard disk as location of zip file ' Restore -if you chose hard disk as location of zip file ' and you specify overwrite ' ' In any other circumstances, it requires user interaction with ' the PKZIP/PKUNZIP, and so the user has to see the DOS window ' to insert disks, hit keys etc etc ' ' ****************************************************************************** ' ' ' ' requires SBDOS.PIF in Windows directory ' SBDOS.PIF is a copy of DOSPRMPT.PIF specifying ' Program as C:\SBDOS.BAT ' ' ' requires PKWARE Products PKZIP.EXE and PKUNZIP.EXE on path ' ' ' SB95 Only ' ' ' To use: CALL BackUpRestore ' ' uses only one global variable, bures As Dialog, rest is all local ' ’’BackupRestore()' Control procedure kphd$’Superbase.RequestHeading Superbase.RequestHeading’"Backup & Restore" ’•"bures" ’’bures ’UDialog ’”Superbase.Dialogs.Exists("BURES")’0’p’ƒBURESMakeD() ’Źbures ’Superbase.Dialogs("BURES") bures.SetActive() bures.Delete() Superbase.RequestHeading’kphd$ ’’’’ ’’BUBackup(ok%%)'Backup Procedure - a) check information & get zipfilename ok%%’0 bures.L2.Caption’"" ’”bures.DOB1.Value’ bures.DOB2.Value’p a%%’0 ’Ųa%%’0 ’Ā"Enter Name For Zip File","",4,a%%,a$,8 ’”a%%’p odir$’’”(Bures.DOB1.Value,"a:\","b:\") bures.L2.Caption’"Zip Name: "’odir$’a$ bures.L2.Visible’’1 bures.L2.Tag’"&" ’^ a%%’1 bures.L1.Caption’"" bures.L2.Tag’"" ’’’” ’Ł ’^’”bures.DOB3.Value’p a%%’0 ’Ųa%%’0 a$’"*.zip":’Ā"Enter Name for Backup File","",27,a%%,a$ ’”a%%’p  bures.L2.Caption’"Zip Name: "’a$  bures.L2.Visible’’1  bures.L2.Tag’"" ’^ bures.L2.Caption’"" bures.L2.Tag’"" a%%’1 ’’’” ’Ł ’’’” ’”bures.L2.Caption’""’p'b) OK to go on - create batch file and call it ’”’J("C:\SBDOS.DIR")’p ’"c:\sbdos.dir" ’’’” ’”’O(bures.L1.Tag’"all")’p ’“"c:\Temp.Txt"’›’¶ x%%’1  ’Ųx%%’0  x%%’Bures.LB1.GetSelected(x%%)  ’”x%%’p’{bures.LB1.List(x%%)  ’Ł ’†’¶ iflist$’" @c:\temp.txt@" allist$’"" ’^ iflist$’"" allist$’" *.* " ’’’” ’“"C:\SBDOS.BAT"’›’¶ ’{’+(bures.Tag,2) ’{"cd "’bures.Tag switch$’"-"’bures.L2.Tag’’”(bures.DCx2.Value,"f","") switch$’switch$’’”(bures.DCx1.Value," -p -R","") cmd$’"pkzip "’switch$’’,(bures.L2.Caption,10)’allist$’" -x*.sb! -xSuperbas.net" cmd$’cmd$’iflist$ ’{cmd$ ’{"dir >c:\sbdos.dir" ’†’¶ mode%%’’”(bures.L2.Tag’"&",1,2) ’ƒ"sbdos.pif",mode%% ’Ļ’›.5 ’Ų’O’J("c:\sbdos.dir") ’Ļ’›.5 ’Ł ok%%’’1 ’’’” ’Žbures.Tag ’’’’ ’’BUFindZip(ok%%)' Find existing Zip file (for either restore or get List for select) ok%%’0 bures.L2.Caption’"" ’”bures.DOB1.Value’ bures.DOB2.Value’ bures.DOB3.Value’p ’”bures.DOB1.Value’p ’Ž"a:\" ’^’”bures.DOB2.Value’p ’Ž"B:\" ’’’” a%%’0 ’Ųa%%’0 a$’"*.zip":’Ā"Enter Name for Restore File","",17,a%%,a$ ’”a%%’p  bures.L2.Caption’"Zip Name: "’a$  bures.L2.Visible’’1  bures.L2.Tag’’”(’+(a$,2)’"[ab]:","F","") ’^ bures.L2.Caption’"" bures.L2.Tag’"" a%%’1 ’’’” ’Ł ’’’” ’”bures.L2.Caption’""’pok%%’’1 ’’’’ ’’BURestore(ok%%)' Restore Procedure ’”bures.L2.Caption’""’p' a) either we have already got or we need to get zipfile name ’ƒBUFindZip(ok%%) ’^ ok%%’1 ’’’” ’”ok%%’p' b) do the restore ’”’J("C:\SBDOS.DIR")’p ’"c:\sbdos.dir" ’’’” ’”’O(bures.L1.Tag’"all")’p ’“"c:\Temp.Txt"’›’¶ x%%’1  ’Ųx%%’0  x%%’Bures.LB1.GetSelected(x%%)  ’”x%%’p’{bures.LB1.List(x%%)  ’Ł ’†’¶ iflist$’" @c:\temp.txt@" allist$’"" ’^ iflist$’"" allist$’" *.* " ’’’” ’“"C:\SBDOS.BAT"’›’¶ ’{’+(bures.Tag,2) ’{"cd "’bures.Tag switch$’"-"’’”(bures.DCx2.Value,"o","") switch$’switch$’’”(bures.DCx1.Value," -d","") cmd$’"pkunzip "’switch$’’,(bures.L2.Caption,10)’allist$ cmd$’cmd$’iflist$ ’{cmd$ ’{"dir >c:\sbdos.dir" ’†’¶ mode%%’’”(bures.L2.Tag’"F"’ bures.DCx2.Value’0,1,2) ’ƒ"sbdos.pif",mode%% ’Ļ’›.5 ’Ų’O’J("c:\sbdos.dir") ’Ļ’›.5 ’Ł ok%%’’1 ’’’” ’Žbures.Tag ’’’’ ’’BURESAct()'Dialog Activate bures.L1.Tag’"All" bures.L2.Tag’"" bures.L2.Caption’"" bures.Tag’’Ž ’’’’ ’’BUGetFiles()'Get files from current directory for selection ’×bcon ’Udialogcontrol ’Źbcon’bures.LB1 bcon.Visible’0 bcon.List.Clear() bcon.AddItem(" {All}") ’“"temp1.txt"’›’¶:z$’"? DIRECTORY ~"’’Ž’"\*.*~ ALL :CLOSE OUTPUT":’–z$ ’Ļ’›1 ’“"temp1.txt"’›’¤' now add to Listbox ’¤’cx$:’¤’cx$:’¤’cx$ ’Ų’O’B("*") f$’’=(’F(’+(x$,12))) ’”’åext(f$)’".sb!"’pf$’""'eliminate .sb! ’”f$’"superbas.net"’pf$’""'eliminate superbas.net ’”f$’""’pbcon.AddItem(f$) ’¤’cx$ ’Ł ’†’¤ bures.L1.Caption’"Select Files to include" bcon.Visible’’1 bcon.SetFocus() ’’’’ ’’BUSelFiles(ok%%)'unzip -v the zip file to scan for files to select ’ƒBUFindZip(ok%%)' a) get zipfilename ’”ok%%’p' b) unzip -v and read info into Listbox ’×bcon ’Udialogcontrol ’Źbcon ’bures.LB1 bcon.Visible’0 bcon.List.Clear() bcon.AddItem(" {All}") f$’’H(’F(’,(bures.L2.Caption,10))) ’”’J("c:\sbdos.dir")’p ’"c:\sbdos.dir" ’’’” ’“"c:\sbdos.Bat"’›’¶ ’{’+(bures.Tag,2) ’{"cd "’bures.Tag ’{ ’{"Echo *** If this appears to hang, then " ’{"Echo *** Insert Last disk in Backup Set" ’{"Echo *** Then hit any key" ’{ switch$’"-v" cmd$’"pkunzip "’switch$’’,(bures.L2.Caption,10)’">temp1.txt" ’{cmd$ ’{"dir >c:\sbdos.dir" ’†’¶ mode%%’’”(bures.L2.Tag’"F",1,2) ’ƒ"sbdos.pif",mode%% ’Ļ’›.5 ’Ų’O’J("c:\sbdos.dir") ’Ļ’›.5 ’Ł ’Žbures.Tag ’“"temp1.txt"’›’¤ ’¤’cx$ x$’’H(x$) ’Ų’O(x$’"Length*")’ ’O’B("*") ’¤’cx$ x$’’H(x$) ’Ł ’¤’cx$:’¤’cx$ ’Ų’0(’+(x$,8))’0’ ’O’B("*") f$’’=(’H(’F(’,(x$,62)))) ’”f$’""’pbcon.AddItem(’åname(f$)) ’¤’cx$ ’Ł ’†’¤ bures.L1.Caption’"Select Files to include" bcon.Visible’’1 bcon.SetFocus() ’’’” ’’’’ ’’BUDCB()'Command Buttons ’É’ęme.Name ’ę"CB1"'Backup Options ’ƒBUSetBack() bures.L1.Visible’’1 bures.CB3.Caption’"Do Backup" bures.CB3.Visible’’1 ’ę"CB2"'Restore Options ’ƒBUSetRes() bures.L1.Visible’’1 bures.CB3.Caption’"Do Restore" bures.CB3.Visible’’1 ’ę"CB3"' Backup or Restore ’É’ęme.Caption  ’ę"Do Restore"  ’ƒBURestore(ok%%)  ’ę"Do Backup"  ’ƒBUBackup(ok%%) ’’’ę ’”ok%%’p  bures.SetActive(0) ’^  ’Ā"Incomplete Information Selected","",2 ’’’” ’ę"CB4"'Cancel bures.SetActive(0) ’’’ę ’’’’ ’’BUOpt()'option button for which drive - if Backup to local, disable format ’”bures.DCx2.Caption’"Format*"’p ’É’ęme.name ’ę"DOB1","DOB2"'Floppies bures.DCx2.Enabled’’1 ’ę"DOB3"'Hard bures.DCx2.Enabled’0 bures.DCx2.Value’0 ’’’ę ’’’” ’’’’ ’’BUCx()'checkBox for file select ’”me.value’p bures.CB1.Visible’0 bures.CB2.Visible’0 bures.CB3.Visible’0 bures.CB4.Visible’0 ’”bures.CB3.Caption’"do backup*"’p ’ƒBUGetFiles()' fill list box from local directory ’^ ’ƒBUSelFiles(ok%%)'file listbox with files from zip ’”ok%%’0’p ’Ā"Incomplete Information","",2 bures.LB1.Visible’0 me.value’0 bures.CB1.Visible’’1 bures.CB2.Visible’’1 bures.CB3.Visible’’1 bures.CB4.Visible’’1 ’’’” ’’’” ’^ bures.LB1.List.Clear() bures.L1.Caption’"All Files" ’’’” ’’’’ ’’BULB()'ListBox DoubleClick/LostFocus bures.L1.Caption’"Selected: " x%%’bures.LB1.GetSelected(0) ’”x%%’1’p bures.L1.Tag’"All" bures.L1.Caption’"Selected: All" ’^’”x%%’p bures.L1.Tag’"Selected" bures.L1.Caption’bures.L1.Caption’bures.LB1.List(x%%) x%%’bures.LB1.GetSelected(x%%) ’”x%%’pbures.L1.Caption’bures.L1.Caption’" +...." ’’’” bures.LB1.Visible’0 bures.CB1.Visible’’1 bures.CB2.Visible’’1 bures.CB3.Visible’’1 bures.CB4.Visible’’1 ’’’’ ’’BUSetBack()'set up Backup info bures.DCx1.Caption’"Store Dir Structure" bures.DCx1.Visible’’1 bures.DCx2.Caption’"Format Diskettes" bures.DCx2.Visible’’1 bures.DCx3.Caption’"Select Files" bures.DCx3.Visible’’1 bures.F1.Visible’’1 bures.DOB1.Visible’’1 bures.DOB2.Visible’’1 bures.DOB3.Visible’’1 bures.L2.Caption’"" bures.L2.Tag’"" ’’’’ ’’BUSetRes()'Set up Restore info bures.DCx1.Caption’"Restore Dir Structure" bures.DCx1.Visible’’1 bures.DCx2.Caption’"Overwrite Existing" bures.DCx2.Visible’’1 bures.DCx3.Caption’"Select Files From Zip" bures.DCx3.Visible’’1 bures.F1.Visible’’1 bures.DOB1.Visible’’1 bures.DOB2.Visible’’1 bures.DOB3.Visible’’1 bures.L2.Caption’"" bures.L2.Tag’"" ’’’’ ’’BURESMakeD()' dialog create ’×dlg ’UDialog ’×control ’UDialogControl Superbase.Dialogs.Add("BURES") ’Źdlg ’Superbase.Dialogs.BURES dlg.Move(68,54,192,138) dlg.Caption’"Backup & Restore" dlg.FontName’"MS Sans Serif" dlg.FontSize’8 dlg.OnActivate’"BURESAct" ’Źcontrol ’dlg.Add("L1","DialogLabel") control.Move(10,4,100,13) control.Caption’"All Files" control.Visible’0 ’Źcontrol ’dlg.Add("L2","DialogLabel") control.Move(118,4,75,26) control.Caption’"" control.Visible’0 ’Źcontrol ’dlg.Add("LB1","DialogListBox") control.Move(98,24,78,100) control.MultiSelect’1 control.Sorted’1 control.Visible’0 control.OnDblClick’"BULB" control.OnLostFocus’"BULB" ’Źcontrol ’dlg.Add("CB1","DialogCommandButton") control.Move(102,36,76,17) control.Caption’"Backup Options" control.ReturnValue’0 control.Cancel’1 control.OnClick’"BUDCB" ’Źcontrol ’dlg.Add("CB2","DialogCommandButton") control.Move(102,60,76,19) control.Caption’"Restore Options" control.ReturnValue’0 control.Cancel’1 control.OnClick’"BUDCB" ’Źcontrol ’dlg.Add("CB3","DialogCommandButton") control.Move(102,88,76,18) control.Caption’"" control.ReturnValue’0 control.Cancel’1 control.Visible’0 control.OnClick’"BUDCB" ’Źcontrol ’dlg.Add("CB4","DialogCommandButton") control.Move(102,112,76,18) control.Caption’"Cancel" control.ReturnValue’0 control.Cancel’1 control.OnClick’"BUDCB" ’Źcontrol ’dlg.Add("DCx1","DialogCheckBox") control.Move(4,92,94,11) control.Caption’"Store Directory Structure" control.Visible’0 ’Źcontrol ’dlg.Add("DCx2","DialogCheckBox") control.Move(8,72,77,11) control.Caption’"Format Diskette(s)" control.Visible’0 ’Źcontrol ’dlg.Add("DCx3","DialogCheckBox") control.Move(4,108,95,12) control.Caption’"Select Files" control.OnClick’"BUCx" control.Visible’0 ’Źcontrol ’dlg.Add("F1","DialogFrame") control.Move(1,21,93,68) control.Caption’"Disk(ette) Drive" control.Visible’0 ’Źcontrol ’dlg.Add("DOB1","DialogOptionButton") control.Move(8,33,82,10) control.Caption’"A: Diskette" control.Visible’0 control.OnClick’"BUOpt" ’Źcontrol ’dlg.Add("DOB2","DialogOptionButton") control.Move(8,44,82,9) control.Caption’"B: Diskette" control.Visible’0 control.OnClick’"BUOpt" ’Źcontrol ’dlg.Add("DOB3","DialogOptionButton") control.Move(8,54,82,10) control.Caption’"Current Directory" control.Visible’0 control.OnClick’"BUOpt" ’’’’