In my archives I found a backup file that was created in 96. Orig
Author unknown. I've modified it as shown below. The question I have
is this; Using the cval function - SET VAR vDrives = (CVAL('Drives'))
- I can find out what drives are on a specific computer, but how can 
I limit the user to using only a valid drive letter? (Around line 35).
The goal would be to have the if then statement do the checking.

Myron Finegold

*(dbackup.cmd 11-3-02)
--CMD to backup a database
--Asks the user where to backup to
--Creates a separate folder by the current date for the backup

-- Housekeeping
SET NULL -0-
SET MESS OFF
SET ERR MESS OFF
SET BELL OFF

-- These next 2 commands are only executed if DEBUG is set to ON!
DEBUG SET MESS ON
DEBUG SET ERR MESS ON

-- Format the screen
SET VAR vmsg1 = 'Backup in progress.'
SET VAR vmsg2 = 'Do Not Interrupt! '
EDIT USING msgform MDI AT 170,170,540,290 AS msgform CAPTION 'Message'

-- Set an error variable
SET ERROR VAR verror

--Determine where to backup the drive
SET VAR vDrives = (CVAL('Drives'))
SET VAR vChoice TEXT
DIAL 'What drive letter do you want ot use?' vChoice +
   vEndkey 1 CAPTION 'Example D or E' at 10
   IF .vChoice = 'E' then
     GOTO ASDF
    ELSE
-- Format the screen
SET VAR vmsg1 = 'Not a valid drive letter'
SET VAR vmsg2 = 'Exiting the backup procedure! '
EDIT USING msgform MDI AT 170,170,540,290 AS msgform CAPTION 'Message'
     GOTO THEEND
LABEL ASDF

-- Create the name of the file which will be in the format of mmddyy.bak
SET VAR vmonth    TEXT = (SGET(CTXT(.#DATE),2,1))
SET VAR vday      TEXT = (SGET(CTXT(.#DATE),2,4))
SET VAR vyear     TEXT = (SGET(CTXT(.#DATE),2,7))
SET VAR vfilename TEXT = (.vmonth+.vday+.vyear+'.bak')

--Get the current drive
SET VAR vDrv = (CVAL('CURRDRV'))

-- Determine the current directory
SET VAR vcurdir = (CVAL('CURRDIR'))

--Sets up the backup location
SET VAR vDrive TEXT
vDrive = (.vChoice + ':')
.vDrive

-- Determine if the BU directory exists which is the current date
-- This put us on the chosen drive
.vDrive
SET VAR vcurdirbak TEXT
SET VAR vcurdirbak = (.vDrive + '\' + .vfilename)
CD .vfilename

-- If we try to change to a directory that doesn't exist, 2065 is
returned
-- to the error variable, verror
IF verror = 2065 THEN
  MKDIR .vfilename
ENDIF
CD .vfilename
OUTPUT .vfilename
UNLOAD ALL
OUTPUT SCREEN

CLOSEWINDOW msgform

--Puts us back in the proper RB directory
.vDrv

-- Format the screen
PAUSE 2 USING 'Backup Completed' 
LABEL THEEND
DEL *.tmp
SET NULL ' '
MAXIMIZE
Clear VAR vChoice, vDrive, vcurdir, vfilename, vmonth, vday, vyear
RETURN

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to