iff %@index[%1,h] eq 0 .or. %@index[%1,?] ge 0 .or. %@index[%1,i] eq 0 then
call bk-hlp.btm %1
endiff
iff %_4ver lt 5 then
cls
beep
screen 2 0
text
This version of BKUP does not support 4DOS version 4.x.
Please use previous versions.
endtext
cancel
endiff
setlocal
set args=%1&
gosub bk-prams
:: (checks and sets various parameters)
:ex_choice
:: (if x or -x specified, the extraction part will work)
iff %@index[%1,x] ge 0 .and. %@index[%1,x] lt 2 then
goto extract_f
endiff
gosub check_args
:: (defining drives for opeations if not defined elsewhere)
:check_compu
:: (checking computer's "name")
if "%compuname"=="" gosub compuname
::goto set_params
:get_date
:: (separates typed date from -s or s ["since"] in date)
iff %@index[%1,/s] ge 0 .or. %@index[%1,-s] ge 0 then
set date0=%@substr[%1,2]
goto set_defaults
elseiff %@index[%1,s] eq 0 then
set date0=%@substr[%1,1]
goto set_defaults
else
goto compu_date
endiff
:compu_date
set days=%@date[%_date]
: This is today'y date in full numbers since 1-1-1980
set date0=%@makedate[%@eval[%days-%1]]
: This is the actual date desired for the archive file.
: If no number of days indicated by user, you get today's
: date again.
if %@index[%date0,0] eq 0 set date0=%@substr[%date0,1]
: If a zero (0) is contained on the first position (01, etc.),
: it will be removed.
:set_defaults
:: (setting: temporary archive name, final archive name;
:: removing: old temporary archive; verifying: colors for message)
::
set rsp=%temp%upd.rsp
set zipfn=%temp%upd.%zip_ext
set tmpf=%@unique[%temp]
if exist %zipfn del /q %zipfn
:: (This is just a precaution; this file is moved anyway, if batch
:: terminates in a normal way.)
if .%colordir==. set colordir=dirs:bright white;zip uc:black on white;
:re-use?
:: (Use again the updates file or create a new one?)
cls
if exist %rsp goto ask
goto accumulate
:ask
:: (use extant list of updates or create a new one?)
echo.
gosub legenda
screen 2 0
inkey /K"YNVESQ" Use extant list file? (created %@filedate[%rsp], at %@filetime[%rsp])? [time now: %_time]n (List File is: %@upper[%rsp])nnType Y/N, V(iew), S(creen), E(dit), or Q(uit) %%rep
iff %rep == Q then cls^screen 2 0^set ech=echo Stopped by user^ goto end
elseiff %rep == Y then goto backup
elseiff %rep == V then *list %rsp^cls^goto ask
elseiff %rep == E then %edt %rsp^goto backup
elseiff %rep == S then echo. >%tmpf^cls^set num=0^goto edit
elseiff %rep == N goto accumulate
endiff
:accumulate
cls
iff %_monitor == mono then
screen 4 5 [ making a list of all new files created since %date0 ]
screen 3 5 Working ...
else
scrput 4 5 gre on whi [ making a list of all new files created since %date0 ]
scrput 3 5 blu on whi Working ...
endiff
:make_list
:: (Create the updates file with 4DOS internal dir /d command
:: [valid only from version 5.x])
cdd %search_drive:\
dir /bsa:a /[d%date0] >%rsp
:check_list
iff %@lines[%rsp] lt 0 then
set ech=scrput 3 17 bri whi on bla No files were found for/since %date0!
del /q %rsp
goto end
endiff
scrput 3 17 bri whi on bla List created as %@upper[%rsp]
:edit?
screen 6 5 Select an option (press first letter):
screen 7 5
text
Screen select files on screen (one file after another)
(this option allows viewing and deleting)
Edit edit results file via editor
View view results before making any decision
Go go to immediate archiving (no selection)
Quit stop now (results file will remain intact)
endtext
screen 16 3
inkey /K"SEQGV[ESC][Enter]" Your choice? %%rep
iff %rep == G then goto backup
elseiff %rep == S .or. %rep == @28 then
echo. >%tmpf
cls
set num=0
goto edit
elseiff %rep == E then
%edt %rsp
goto backup
elseiff %rep == V then
*list %rsp
cls^goto edit?
elseiff %rep == Q .or. %rep == %@char[27] then
set ech=echo Stopped by user^goto end
endiff
:edit
rem This procedure displays all the files saved today, one by one,
: allowing you to (a) select only those you wish to back up, or
: (b) delete, or (c) view a file before making a decision, or
: (d) view the list of selections, or (e) stop selecting and go
: to immediate archiving, or (f) quit.
:
iff %@eval[%num] gt %@lines[%rsp] then
move /q %tmpf %rsp
goto backup
endiff
set fn=%@line[%rsp,%num]
if .%fn==. (set num=%@eval[%num+1]^goto edit)
scrput 0 0 black on white Accept=A/enter Omit=O/Esc D=Delete V=View G=Begin archiving L=View list Q=Quit